I may have found an algorithm myself:

Input: way A, way B with the same name/ref
Output: true if all of A(or B) is parallel to B(or A)

foreach Node a in A do:
  if distance(a, B) > X then
    return false;
  endif
done

foreach Node b in B do:
  if distance(b, A) > X then
    return false;
  endif
done

return true

Note that I don't care about oneway=true as this is for
rendering low zoom levels (LOD1=a whole city, LOD2=a whole state, LOD3=a
whole country/continent)

Marcus


On Tue, 17 Mar 2009 12:55:00 +0100, <marcus.wolsc...@googlemail.com> wrote:
> Hello,
> 
> I am currently presented with a quite puzzling problem.
> For low zoom levels Traveling Salesman (or more exact, the LODDataSet)
> merges streets that are broken up into multiple ways
> into as few ways as possible and then simplifies these polylines.
> 
> Now there are road-constellations (first detected in Helsinki, Finnland
> Bug-ticket: http://travelingsales.sourceforge.net/bugs/view.php?id=52)
> where roads start as 2 parallel ways with oneway=true, then merge into
> a single way and then split up into 2 parallel ways with oneway=true
again.
> One example would be "name=Pakilantue" near the crossing with "name=Kehä
> I".
> Another example would be pretty much any german motorway.
> 
> I would like to detect such ways and merge the 2 parallel ways into a
> single one.
> My question:
> Given only the 2 parallel ways and their nodes, how could I detect these
> to be 2 lanes of the same street?
> 
> I know/I can assume:
> * they have the same namd and/or ref
> * both are oneway=true
> 
> I can not assume:
> * that both ways meet at a common point like in Helsinki
> 
> 
> Marcus
> 

_______________________________________________
dev mailing list
dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/dev

Reply via email to