Pergunta

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?

Foi útil?

Solução

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top