var vectorLayer = new ol.layer.Vector({ source: new ol.source.Vector({ format: new ol.format.GeoJSON(), url: 'url_of_your_file' })});map.addLayer(vectorLayer);通过这种方式,您可以将GeoJSON文件加载到地图中.This way you can load a GeoJSON file into your map.例如,如果您想要一个圆形标记,可以将样式添加到 ol.layer.Vector 喜欢:If you want, say, a circle marker you add a style to ol.layer.Vector like:var vectorLayer = new ol.layer.Vector({ source: new ol.source.Vector({ format: new ol.format.GeoJSON(), url: 'url_of_your_file' }), style: new ol.style.Style({ image: new ol.style.Circle({ radius: 10, fill: new ol.style.Fill({ color: '#ffff00' }) }) })}); 这篇关于如何在OpenLayers 3中创建静态标记?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-18 13:10