简单的思路如下:
1、在arcgis中获得shp文件
2、将其转成geojson文件
3、用openlayers进行展示
第一步直接省略
第二步这里推荐一个shp转geojson很方便的工具网站http://mapshaper.org/,具体格式如下:
第三步 然后就是关键的一步,用代码实现,采用ajax
$.ajax({ url: "data/ViewPoint.json", async: false, success: function (data) { //构建关键点矢量图层 vectorLayerViewPoint = new ol.layer.Vector({ source: new ol.source.Vector({ features: (new ol.format.GeoJSON()).readFeatures(JSON.stringify(data)) }), style:new ol.style.Style({ image:new ol.style.Icon({ anchor: [0.5, 30],//锚 anchorXUnits: 'fraction', anchorYUnits: 'pixels', opacity: 1,//透明程度 src: 'img/KeyPoint.png' }) }) }); } });
效果如下: