Openlayer图层载入时进行坐标系的转换

Openlayer地图和要添加的图层坐标系不一致的时候,需要进行转换,如下例所示:

var format = new ol.format.WKT();
var feature;
$.each(data, function (i, link) {
    feature = format.readFeature(link.geom, {
      dataProjection: 'EPSG:4326',
      featureProjection: 'EPSG:3857'
    });
    wktTraffic.addFeature(feature);
})

转载自:https://blog.csdn.net/dazhi_1314/article/details/77683959

You may also like...