Reputation: 301
There doesn't seem to be any column that represents lat-lon information for a particular node. I imported data into PostGIS using osm2pgsql. Any ideas on how to get this information?
Thanks in advance
EDIT: I got it working with this:
SELECT ST_Y(ST_Transform(way, 4326)) AS lat, ST_X(ST_Transform(way, 4326)) AS long
FROM planet_osm_point;
Upvotes: 1
Views: 963
Reputation: 43642
There are many geometry output functions to convert a geometry to a human-readable form.
For example, using ST_AsLatLonText on a Point geometry:
SELECT (ST_AsLatLonText('POINT (-3.2342342 -2.32498)'));
st_aslatlontext
----------------------------
2°19'29.928"S 3°14'3.243"W
Or if you need individual coordinates as floating point values, use ST_X and ST_Y for longitude and latitude, respectively.
Upvotes: 1