My script allows you to drawn shapes on an OpenLayers map, and then to get the WKT information from that shape, except the returned coordinates are in EPSG::900913 and I need them to be in lat/lon.
[GIS] How to convert drawn vector feature from EPSG:900913 to EPSG:4326
convertcoordinatesopenlayerswell-known-text
Related Question
- [GIS] OpenLayers 3 display WFS EPSG:4326 on EPSG:3857 map
- [GIS] Convert OL3 drawn polygon to WKT for inserting to PostGIS
- OpenLayers – How to Get a Drawn Feature ID in OpenLayers?
- OpenLayers 5.3.0 – Transformation Shift/Distortion from EPSG:4326 to EPSG:3857
- OpenLayers – View and Save Coordinates from Drawn Features in OpenLayers 5
Best Answer
You need to project (transform) the shape from EPSG:900913 (actually use the standard EPSG:3857) to EPSG:4326.
You can use the following code: