문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top