1

I downloaded the file italy.osm and import to postgresql with postgis.

So i try to extract latitude and longitude from the field "way" (geometry) of the table planet_osm_point, using the functions ST_X(), ST_Y() and these are the coordinates that I get as a result by querying a point in center of Milan City.

X: 1025988.29850153 Y: 5709056.87437553

I'm doing something wrong?

eold
  • 324
  • 4
  • 12
  • Fixed by using st_x(st_transform(way, 4326)), but before i add to spatial_ref_sys this portion of SQL [link]http://spatialreference.org/ref/epsg/4326/postgis/ – eold Mar 26 '13 at 13:50

1 Answers1

2

The data need to be projected to WGS84:

SELECT ST_Y(ST_Transform(way, 4326)) AS lat, ST_X(ST_Transform(way, 4326)) AS long
FROM planet_osm_point;

Don't install the spatial reference from spatialreference.org (which is srid=94326), as you should already have this when you spatially enabled the database. If srid=4326 wasn't already there, then there was a problem or skipped step when you spatially enabled the database.

Mike T
  • 41,085
  • 18
  • 152
  • 203