More

How do I convert the coordinate data from osm into actual longitude latitude points

How do I convert the coordinate data from osm into actual longitude latitude points


So I've imported a osm dataset into a PostGIS db using osm2pgsql, however when I call

ST_asText( way )

I get weird coordinates like

"POINT(16767838.9 -4051592.94)"

What format are these longitude latitude points? How do I convert them to I guess "normal" longitude latitude points like

"lat":-36.51985035227977,"lng":148.04298681640626

If you never want to use web mercator coordinates you can import using the osm2pgsql--latlongoption. That will store the coordinates as wgs84 lat/lon.

See the osm2pgsql command line docs for further information: https://github.com/openstreetmap/osm2pgsql/blob/master/docs/usage.md


OSM stores coordinates in Web Mercator projection, EPSG:3857.

as @user30184 says, transform them to EPSG:4326 (that is, wgs84 lat/lon) using

select ST_AsText(ST_Transform(way, 4326))

Watch the video: Was sind Längen- und Breitengrade? Erdkunde