[OSM-dev] Spatial vs. multi-column indexes for points
Andreas Kalsch
andreaskalsch at gmx.de
Fri Sep 12 15:50:00 BST 2008
> Florian Lohoff wrote:
> > On Fri, Sep 12, 2008 at 08:20:18AM +0200, Andreas Kalsch wrote:
> >
> >> Subject: Re: [OSM-dev] Spatial vs. multi-column indexes for points
> >>
> >>
> >>> On Thu, Sep 11, 2008 at 08:31:23PM +0200, Andreas Kalsch wrote:
> >>>
> >>>> All, thanks for your quick responses!
> >>>>
> >>>> Quad tiles look like a smart way to create an index. So to lookup a
> >>>> single point or a quad tile, this is fine. But for my application I
> >>>> need another lookup - by bounding box with any ratio and size. Is
> >>>> there a way to look up a special bounding box with this index? I
> >>>> think this will be a little more complicated without conventional
> >>>> multi-column indices. Hmm, I think you could take a maximum number
> >>>> of quad lookups which contain the requested box, what do you think?
> >>>>
> >>> The code in the api calculates all possible quadtile areas and does a
> >>> quadtile in ( x, y, z, a, b, c, d, e, f ) or quadtile between x and y
> >>> etc
> >>>
> >> Can you give me the position of this code in SVN, I am sure will
> understand it more deeply then.
> >>
> >
> > applications/utils/export/osm2ai/osm2ai.pl
> >
> > Is a perl variant - look for "sql_for_area"
> >
> > In the rails_ports its done with a C helper - look in
> >
> > sites/rails_port/lib/quad_tile/
> >
> or for the rails version
> http://trac.openstreetmap.org/browser/sites/rails_port/lib/quad_tile.rb
>
> Shaun
>
Thanks!
And this really outperforms a simple query like "... latitude between y1 and y2 and longitude between x1 and x2" ?
I will use 2^24 tiles as length. It looks like "tiles_for_area" goes through all tiles which are in the bounding box. So if I have an area with e.g. 5x5 kilometers, it will loop through 2000x2000 = 4 Million tiles. And so the SQL for this are will be quite big, won't it?
Or am I totally wrong now? ;)
--
GMX Kostenlose Spiele: Einfach online spielen und Spaß haben mit Pastry Passion!
http://games.entertainment.gmx.net/de/entertainment/games/free/puzzle/6169196
More information about the dev
mailing list