[postgis-users] How to match lines between two similar graphs?

Charles Galpin cgalpin at lhsw.com
Thu Jan 26 12:01:19 PST 2012

Stephen, do you mind sharing what the source of the traffic disruption feed is? Mainly curious if it's one of the ones we use (email direct if needed).  I had tried to do something similar a while ago but honestly did not make good progress (this was before I found st_HausdorffDistance and need to give that a try too).  But I found that problems with both the input data being inaccurate and the Navteq data not always being complete caused all kinds of problems getting the matches accurate.  If the input data isn't accurate or you don't have proper direction info it's very easy to pick the wrong lane or side of the street. Express lanes, upper/lower levels, and complex geometries at intersections all contributed to making the matching hard.

Nicolas,  I had to do something similar with a navteq version update. In my case we'd stored the link ids from the old data set for various reasons and needed to figure out what the new link ids were for ones that had changed. As you know Navteq "retires" the ids for any change, including geometry  changes.  I found a combination of  st_HausdorffDistance and things like making sure the direction matched got me a large portion of them matched in an automated fashion, and did the remainder semi-manually.

Matej, when you asked before I didn't understand everything you were trying to do, but to answer your question about the data being in the same table, you just need to do a self join to compare each row to all the others.

select <whatever that operation was>(t1.the_geom, t2.the_geom) from 
table1 t1, table2 t2
where t1.id != t2.id
and <some operation to determine if they are close>


On Jan 26, 2012, at 1:56 PM, Stephen Woodbridge wrote:

> Nicolas,
> I am still waiting on the actual data. The input is a traffic disruption feed with ids to one dataset and I need to map the identified segments to the equivalent segments in a Navteq data set. I suspect that I will have a combination of connected segments that form a sub-network and not a single path. But some of the sample feed data I do have references a single segment, like the location of an accident. In other cases, like a major construction project that affects multiple segments on multiple streets it will be a sub-net.
> -Steve

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20120126/2e87ce08/attachment.html>

More information about the postgis-users mailing list