先说矢量数据集接入,我们通过GeoJSON的示例代码(http://openlayers.org/en/latest/examples/geojson.html)了解Openlayers的源代码,确定显示要素绘制是调用ol.source.vector的forEachFeatureInExtent方法,所以我们根据ol.source.vector构建了ol.source.VectorMapZone,重写forEachFeatureInExtent方法,将查询结果转换成Openlayers3的Geometry和Feature,即可实现矢量数据集的接入

重写forEachFeatureInExtent方法

如何在openlayer接入矢量数据

初始化ol.source.VectorMapZone,并做为数据源设置到Openlayers3的layer中

如何在openlayer接入矢量数据

显示效果:

如何在openlayer接入矢量数据

相关文章:

  • 2021-04-20
  • 2021-12-21
  • 2021-07-26
  • 2021-08-01
  • 2021-12-31
  • 2021-05-17
  • 2021-07-11
  • 2022-12-23
猜你喜欢
  • 2021-05-25
  • 2022-12-23
  • 2022-12-23
  • 2021-09-17
  • 2021-06-20
  • 2021-07-18
  • 2021-06-10
相关资源
相似解决方案