ol3之加载geojson数据
作者:互联网
ol3之加载geojson数据
数据:
let data = { "type": "Feature", "geometry": { "type": "Point", "coordinates": [125.6, 10.1] }, "properties": { "name": "Dinagat Islands" } }
加载图层:
var vectorSource = new ol.source.Vector({ features: (new ol.format.GeoJSON()).readFeatures(data) }); var vectorLayer = new ol.layer.Vector({ source: vectorSource, style: '' }); this.map.addLayer(vectorLayer)
定位:
let extent = vectorSource.getExtent() this.view.fit(extent)
钻研不易,转载请注明出处。。。。。。
标签:ol,geojson,vectorSource,ol3,new,vectorLayer,加载 来源: https://www.cnblogs.com/s313139232/p/15253749.html