【处理WKT格式字符串】
var splitfeature = new ol.format.WKT().readFeature(('WKT字符串'), {
dataProjection: 'EPSG:4326', //目标坐标系
featureProjection: 'EPSG:4326' //当前坐标系
});
source.addFeatures(splitfeature);
var vectorLayer = new ol.layer.Vector({source: source});
map.addLayer(vectorLayer);
【处理GeoJSON格式字符串】
var splitfeature = new ol.format.GeoJSON().readFeature(('GeoJSON字符串'), {
featureProjection: 'EPSG:4326' //当前坐标系
});
vectorSource.addFeature(splitfeature);