Openlayers中Feature與WKT之間的轉換,Feature座標系的轉換

一、Feature 轉WKT 且帶座標系的轉換spa

     var strwkt = new ol.format.WKT().writeFeature(feature, {
                dataProjection: targetcrs,//目標座標系
                featureProjection:crs  //當前座標系
            });orm

 二、WKT轉Feature get

  var newfeature = new ol.format.WKT().readFeature(strwkt);it

三、Feature 座標系轉換(支持全部圖形)io

  var geom = feature.getGeometry().transform(crs, targetcrs);
  feature.setGeometry(geom);form

四、利用WKT轉換Feature座標系(這種不支持GEOMETRY不爲Circle)class

  var strwkt = new ol.format.WKT().writeFeature(feature, {
                dataProjection: targetcrs,
                featureProjection:crs
            });
            var newfeature = new ol.format.WKT().readFeature(strwkt);transform

注意:方法4獲得的Feature 會沒有原始Feature對應的Properties
           方法

相關文章
相關標籤/搜索