cwjmycoolsky

Openlayers中Feature与WKT之间的转换,Feature坐标系的转换

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
           

posted on 2018-10-10 09:00 cwjmycoolsky 阅读(...) 评论(...) 编辑 收藏
 
 

分类:

技术点:

相关文章:

  • 2021-05-26
  • 2021-11-14
  • 2021-11-03
  • 2022-12-23
  • 2021-11-03
  • 2021-07-24
  • 2022-01-23
猜你喜欢
  • 2022-12-23
  • 2018-01-04
  • 2021-12-28
  • 2022-12-23
  • 2022-12-23
  • 2021-05-02
  • 2021-10-18
相关资源
相似解决方案