[OSM-newbies] Ways/areas bounding boxes and QuadTiles
Kelly Jones
kelly.terry.jones at gmail.com
Mon Dec 24 01:48:47 GMT 2007
Have QuadTiles solved the "enclosed area"/"segment outside tile" problems?
The problems:
% If you request a tile that's completely enclosed by an area, you
won't "see" that area, since all of its nodes lie outside the
requested tile.
% If a way goes through a tile, but has no nodes in that tile, you
won't see that "way" for the same reason as above.
The wiki page (http://wiki.openstreetmap.org/index.php/QuadTiles)
seems to suggest storing all the tiles a way/area goes through or
encloses (including tiles where the way/area has no nodes), but this
seems inefficient.
Another approach is to store the "bounding box" for each way/area: the
smallest QuadTile that completely encloses the way/area.
Then, when you're looking for ways/area that intersect a given tile,
start with the largest tiles and work your way down.
Example: I want the ways/areas intersecting ACBDCBADC.
I start by looking at the ways/areas whose bounding box is 'A'
(probably aren't any, since that's 1/4 of the world). I then look at
the ways/areas whose bounding box is 'AC', 'ACB', 'ACBD', etc.
Of course, it's possible that a way has 'ACBD' as its bounding box,
but still doesn't intersect ACBDCBADC, so this process only gives me
candidates-- I still have to post-process to confirm the ways/areas
actually intersect my tile.
The process can be extended once for ways/areas entirely within the
tile. For example, I can look for ways/areas with bounding box
'ACBDCBADC?' (where '?' is exactly one character), then for ways/areas
with bounding box 'ACBDCBADC??', and so on.
If I'm limiting myself to the 1000 (for example) biggest ways/areas, I
can stop when I've found enough -- I don't have to look for ways/areas
with bounding boxes matching "ACBDCBADC????????????????" for example.
Of course, recent versions of MySQL support polygons/etc, and that
might be another approach.
--
We're just a Bunch Of Regular Guys, a collective group that's trying
to understand and assimilate technology. We feel that resistance to
new ideas and technology is unwise and ultimately futile.
More information about the newbies
mailing list