[OSM-dev] Potlatch update

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


> 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
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 ;-)


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

More information about the dev mailing list