[OSM-dev] Map rendering code... API or database direct?

immanuel.scholz at gmx.de immanuel.scholz at gmx.de
Thu Mar 30 14:58:38 BST 2006


On Thursday 30 March 2006 14:47, Richard Fairhurst wrote:
> Raphaël wrote:
> > with postgresql 8.1 (that includes the postgis geometric objects),
> > it's even easier :D
> >
> > SELECT * FROM segments WHERE
> > 	( point_a @ box('(x1,y1),(x2,y2)') ) OR
> > 	( point_b @ box('(x1,y1),(x2,y2)') )
>
> I don't speak postgresql, I'm afraid, but doesn't that still have the
> problem represented in Imi's ASCII art - i.e. point_a and point_b are both
> outside the box, but the line between them crosses a corner?

Yes, it is. So if you want a fast way to get all segments that may be needed 
to draw the current tile, you should not use the above but Richard's former 
suggestion (in some other mail).

If you are only interesting in line segments that have one node within the 
current tile (as you drawed with ascii before), then use the statement above.

Ciao, Imi.

PS: Remeber: The best solution is to fire up a trac ticket (or verify whether 
there is already one) to have the API map request return correctly all line 
segments necessary. Then use the API instead of writing your own SQL. ;-)




More information about the dev mailing list