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

Richard Fairhurst richard at systemeD.net
Thu Mar 30 13:02:24 BST 2006


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?

xmax is between $bbox_xmin and $bbox_xmax, so the first part is true
ymin is between $bbox_ymin and $bbox_ymax, so the second part is true
therefore the ANDed condition is true.

If it's flawed I should probably tell the Waterscape chaps, as this is 
the query that chooses waterway lines for their maps. :)

cheers
Richard





More information about the dev mailing list