1、Feature 转WKT 且带坐标系的转换
var strwkt = new ol.format.WKT().writeFeature(feature, {
dataProjection: targetcrs,//目标坐标系
featureProjection:crs //当前坐标系
});
2、WKT转Feature
var newfeature = new ol.format.WKT().readFeature(strwkt);
3、Feature 坐标系转换(支持所有图形)
var geom = feature.getGeometry().transform(crs, targetcrs);
feature.setGeometry(geom);
4、利用WKT转换Feature坐标系(这种不支持GEOMETRY不为Circle)
var strwkt = new ol.format.WKT().writeFeature(feature, {
dataProjection: targetcrs,
featureProjection:crs
});
var newfeature = new ol.format.WKT().readFeature(strwkt);
注意:方法4得到的Feature 会没有原始Feature对应的Properties