Transform an polygon from epsg:3413 to epsg:4326 in openlayers

242 Views Asked by At

My goal is using the polygon drawed by user under epsg:3413 as one args to find other polygons within. While i transform the polygon simplely using ol.transform, some problems occured. If the north polar is overlapped under epsg:3413, the transform result under epsg:4326 would not.

this.draw.on('drawend', function(e) {
      e.feature.setId(e.feature.ol_uid)
      var geometry = e.feature.getGeometry()
      var geoCo = geometry.getCoordinates();
      geoCo = geoCo[0];
      var center_X = 0, center_Y = 0;
      for(var i = 0; i < geoCo.length; i++) {
        geoCo[i] = transform(geoCo[i], document.getElementById('view-projection').getProjection(viewProjSelect.value).code_, 'EPSG:4326');
        geoCo[i][0] = geoCo[i][0].toFixed(4);
        geoCo[i][1] = geoCo[i][1].toFixed(4);
      }
      _self.ImageryArgs.geoInfo.corrdinates = geoCo;
      _self.map.removeInteraction(_self.draw)
    })

the polygon under epsg:3413 which contains the north polar

the polygon with same points and under epsg:4236, without containing the north polar

I wonder if there any transform methods would make sure the result overlap the north polar in similar cases

0

There are 0 best solutions below