[OSM-dev] [PATCH] osm2pgsql tile expiry
Steve Hill
steve at nexusuk.org
Sun Feb 8 12:24:49 GMT 2009
On Sun, 8 Feb 2009, Martijn van Oosterhout wrote:
> - The use of -o. Is there any other output osm2pgsql could produce
> that would be more logical. Not really a big deal, the long option
> expire-output is there which is good enough for me.
I can't think of anything else that osm2pgsql outputs, but I'm open to
suggestions for a more intuitive option.
> - There a whole new file added (expire-tiles.c) which seems to have
> some kind of tree structure. Do you think you could add a comment at
> the beginning what kind of structure it is and any relevent invariants
> (like middle-ram.c does).
It is a simple binary tree of tiles' X coordinates with each node
containing a binary tree of Y coordinates. I will add a comment
explaining the structure.
Its memory requirements are not capped, but daily diffs seem to result in
a few hundred thousand dirty tiles at zoom 17, which are easilly
accommodated. Running with the -e option for the initial import of the
whole planet would be a Very Bad Thing though. :)
I was originally intending the binary tree to be a quick hack to be
replaced with a better structure (possibly a b-tree) once the rest of the
code was working, but it turned out not to pose any noticable performance
problems so I have left it as-is for now.
> - Does middle.h need to include osmtypes.h?
It makes use of struct osmNode, which is defined in osmtypes.h. I added
the include so that osmtypes.h didn't need to be explicitly included
before middle.h in .c files, but I can remove this again if that is
preferred.
> - You've got a definition of EARTH_CIRCUMFERENCE. Does that match with
> what's used in the projection code?
Good question. Looks like the projection code for Spherical Mercator
defines an Earth radius of 6378137m. This gives us a circumference of:
2 * 6378137 * 3.14159265358979323846 = 40075016.68557848615314309804
I'm using 40075016.68, which I'd say is as close as it needs to be.
Of course, this is going to break if someone is not using Spherical
Mercator - maybe I should add code to exit with an error if a different
projection is used (the OSM tiles are defined in terms of Spherical
Mercator coordinates so the tile list generated is going to be fairly
meaningless for other projections).
- Steve
xmpp:steve at nexusuk.org sip:steve at nexusuk.org http://www.nexusuk.org/
Servatis a periculum, servatis a maleficum - Whisper, Evanescence
More information about the dev
mailing list