[OSM-dev] Potlatch update

Frederik Ramm frederik at remote.org
Tue May 8 13:32:29 BST 2007


Hi,

> I guess the
> best option would be a query to 'select all those nodes within this
> area which aren't in a segment'

I am unfamiliar with the data structure but assuming you have a table  
"nodes" and a table "segments", both with an "id", and "segments"  
having a "fromnode" and a "tonode" value, it would probably be done  
like this:

SELECT nodes.id
FROM nodes
LEFT OUTER JOIN segments
ON (segments.fromnode=nodes.id OR segments.tonode=nodes.id)
WHERE ... put your node-in-bounding-box condition here ...
AND segment.id IS NULL;

This will first try to pair up all nodes with segments using them,  
and later use only those records where pairing didn't work out.

Pray that the SQL engine is smart enough to apply the bounding box  
constraint first and not pair up all the nodes in the world ;-)

Bye
Frederik

-- 
Frederik Ramm  ##  eMail frederik at remote.org  ##  N49°00.09' E008°23.33'






More information about the dev mailing list