Fw: [OSM-dev] Map rendering code... API or database direct?
Nick Whitelegg
Nick.Whitelegg at solent.ac.uk
Thu Mar 30 16:20:34 BST 2006
---------------------- Forwarded by Nick Whitelegg/FT/Southampton
Institute on 30/03/2006 16:20 ---------------------------
Nick Whitelegg
30/03/2006 16:20
To: immanuel.scholz at gmx.de
cc:
Subject: Re: [OSM-dev] Map rendering code... API or database
direct?
> Imi wrote:
> > Hi,
> >
>> >> SELECT id,path FROM segments WHERE
>> >> ((xmin BETWEEN $bbox_xmin AND $bbox_xmax) OR
>> >> (xmax BETWEEN $bbox_xmin AND $bbox_xmax) OR
>> >> (xmin<$bbox_xmin AND xmax>$bbox_xmax)) AND
>> >> ((ymin BETWEEN $bbox_ymin AND $bbox_ymax) OR
>> >> (ymax BETWEEN $bbox_ymin AND $bbox_ymax) OR
>> >> (ymin<$bbox_ymin AND ymax>$bbox_ymax))
>> >> [SQL snipped]
>> >> where xmin, xmax, ymin and ymax are the bounding box of each
segment,
>> >> and $bbox_xmin, $bbox_xmax etc. are the bounding box of the current
>> >> map
>> >> view (tile).
>> >
>> > See my other posting why this is still flawed.
>>
>> It works for your ASCII art suggestion, doesn't it?
>Yes, you are right, I am sorry. This is indeed the algorithm represented
in
>SQL to choose very quickly all segments that could cross the actual
bounding
>box.
Would this work though?
Consider the case below:
bbox_xmin bbox_xmax
| |
| | B
------------------*-------bbox_ymax
| BBOX | *
| BBOX | *
---------------*----------bbox_ymin
| *
| *|
| * |
| * |
| * |
| * |
|* |
* |
A
A=(xmin,ymin)
B=(xmax,ymax)
The starred line AB satisfies the condition:
(xmin<$bbox_xmin AND xmax>$bbox_xmax) AND (ymin<$bbox_ymin AND
ymax>$bbox_ymax)
yet never passes through the bounding box.
Nick
More information about the dev
mailing list