0

I want to preserve shape of objects, so how do I implement "conformal mapping" in openlayers 4.6.5?

My current objects: I have several geoJSON objects (WGS84) around the globe in long/lat with a given shape. These objects are converted to 3857 this way:

ol.proj.transform([long, lat], 'EPSG:4326', 'EPSG:3857').

My current map: Using this: map.getView().getProjection(); I get the following output:

xb {wb: "EPSG:3857", a: "m", i: Array(4), oe: Array(4), b: "enu", …}

My previous post : Getting different resolution between horizontal/vertical directions, from lon/lat to openlayers map?

also explains what i want to achieve, however how do i do it in practice?

Post and pages already read:

otk
  • 215
  • 1
  • 10
  • 2
    There isn't a conformal projection which covers the whole globe. One solution would be to maintain a "rolling" projection which is correct at the view center such as its local UTM projection: https://codepen.io/mike-000/pen/rNBjaEx When zoomed out there will be distortion at the edges but otherwise the scale will be close to true. – Mike Aug 22 '19 at 13:29
  • Very good answer, this is exactly what i need! (I think). UTM is the ideal solution. The objects are never bigger then 700 meters in any direction, and when viewing the object, the rest of the map is completely irrelevant :) One question: In your suggested solution, do i need to "translate" my center coordinates in lon/lat to any "UTM-current_meridian" or can i use them "as-is"? (If you understand my question). – otk Aug 23 '19 at 06:39
  • This means i have to include proj4js, yes ? https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.5.0/proj4.js – otk Aug 23 '19 at 08:10
  • Ok, i see now that the translation i asked about in the first comment is already in the codepen. However, for some regions i need to append customized zones, ref: https://gis.stackexchange.com/questions/13291/computing-utm-zone-from-lat-long-point @Mike , or does it implement in your codepen aswell? – otk Aug 23 '19 at 11:35
  • 1
    It hasn't made any provision for special areas such as Svalbard. Those are intended to avoid high arctic regions being fragmented into multiple zones, but for conformal results sticking to 3 degrees either side of a central meridian would be better. – Mike Aug 23 '19 at 12:23
  • The code currently reprojects vector features from the old to new projection when the view projection is updated. That works well when panning across an area such as Europe, but if the map is panned to Japan features in Europe become unprojectable and with the current code the geometry is corrupted. To be able to pan around the world geometries would need to be saved as lon/lat and reprojected geometries created from that. – Mike Aug 23 '19 at 12:25

0 Answers0