[OSM-dev] osm2pgsql - coordinates units
Graham Jones
grahamjones139 at googlemail.com
Sat Jan 2 12:22:54 GMT 2010
Hi,
I have a little Python application that populates a posgresql database using
osm2pgsql, renders a map with mapnik and extracts information from the
database to highlight points of interest.
I am having a bit of trouble with working out what units the coordinates of
nodes are in in the postgresql database and hope it is obvious to someone:
I am using the -m option, which I think means it will use a spherical
mercator projection ("+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0
+lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs
+over"). I am using the same projection in my Python code.
What I find though is that when I use the mapnik.Projection() function to
translate from lat/lon to spherical mercator y/x, my calculated values are a
factor of 100 less than those in the postgresql database - If I just divide
the postgresql database values by 100 and I plot them on my map they end up
in the correct places.
It looks to me as though osm2pgsql must be storing the x/y values as
integers in units of centimetres, but I thought that it was supposed to be
in units of metres.
Is this the case, or have I got something wrong with my projections (If the
answer is not obvious I will go and work out the maths myself to see what
order of magnitude the xy values should be - I am not used to working in
these coordinates).
Thanks,
Graham.
--
Dr. Graham Jones
Hartlepool, UK
email: grahamjones139 at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20100102/211b4628/attachment.html>
More information about the dev
mailing list