[OSM-talk] project
Jon Burgess
jburgess777 at googlemail.com
Sun Apr 11 22:40:12 BST 2010
On Sun, 2010-04-11 at 22:36 +0200, Torsten Mohr wrote:
> Hello,
>
> i created a GIS database and imported the planet data with osm2pgsql -m.
> So the data is stored in mercaator format.
>
> When executing this raw SQL query:
>
> select st_X(way), st_Y(way), name from planet_osm_point where capital='yes';
>
> Then i get some data like:
>
> st_x | st_y | name
> -------------------+-------------------+----------------------------
> -18915583.203791 | -2162182.86527014 | Alofi
> -11035458.4801666 | 2205926.10968281 | Ciudad de México
> -10075876.3988655 | 1648035.49949994 | Guatemala City
>
> How can i reproject the st_x and st_y to latitude / longitude?
>
> I'd like to do this in an own program. I already reprojected some
> Tiff data from latitude / longitude to mercaator, that worked fine.
>
> But i don't know what st_x and st_y actually are, how they are scaled,
> what is their offset. The documentation for st_X and st_Y didn't help
> me for this issue.
>
> Can anybody please explain to me what st_x and st_y are, how they are scaled,
> what is their offset so i can reproject these data to latitude / longitude?
The are coordinates are plain 900913 data with no scaling or offset.
Postgis can project this back to latlong (4326) for you, e.g.
select st_X(wayLL), st_Y(wayLL), name from (select ST_AsText(ST_Transform(way,4326)) as wayLL, name from planet_osm_point where capital='yes') as foo limit 5;
st_x | st_y | name
------------+-------------------+-------------------
15.0489992 | 12.1130018 | N’Djamena نجامينا
15.3125301 | -4.3102408 |
9.4540009 | 0.390002200000005 | Libreville
10.1862628 | 36.8002392 | تونس
14.4212127 | 50.0876559 | Praha
(5 rows)
Alternatively there are formulas on the wiki to convert between latlong
and 900913. http://wiki.openstreetmap.org/wiki/Mercator
Jon
More information about the talk
mailing list