[OSM-talk] Addr:streetnumber:first;last:left;right

marcus.wolschon at googlemail.com marcus.wolschon at googlemail.com
Tue Apr 7 09:04:02 BST 2009


On Mon, 6 Apr 2009 21:08:15 -0400 (EDT), Steve Singer
<ssinger_pg at sympatico.ca> wrote:
> If the interpolation ways model the geometry of the original way just
> offset 
> by some factor then the interpolation ways wouldn't cross the street 
> segment.  If your source for the addresses is the same as the source for 
> your roads (as is this case with geobase) then this isn't hard to
implement

Sorry to disasspoint you but if the road turns by more then 90° then
a copy of the way offset along the normal at the start-point would cross
the way.
You would need to have each of the nodes offset along the average of normal
of both segments before and after each point. so:

createInterpokationWay(way w, int offset) {

Node startInterpNode = new Node(w.getNode(0).location + 
   offset * w.getNode(0).getNextSegment().vectorNormalLeft());

foreach (Node n in w.nodes except 0 and last) {
  Vector last = w.getNode(0).getLastSegment().vectorNormalLeft();
  Vector next = w.getNode(0).getNextSegment().vectorNormalLeft();
  Vector normalVector = 
          new Vector((last[0] + next[0]) / 2,
                     (last[1] + next[1]) / 2).normalize()
  Node interpNode = new Node(w.getNode(0).location + 
     offset * normalVector );
}

Node endInterpNode = new Node(w.getNode(last).location + 
   offset * w.getNode(last).getLastSegment().vectorNormalLeft());

}

Not as difficult as andrzej thought it would be.


> 
> but results in a lot of extra nodes.  If your trying to overlay some
> address 
> data onto existing roads this becames a bit harder but is still doable
(get
> 
> the project your addresses onto the road segment, and duplicate+offset
it).
> 
> The big concern I have with having the interpolation ways model the
> geometry 
> of the original road is that we are increasing the number of nodes (and 
> ways) required by a factor of 3.  One set of nodes + way for the road, a 
> second set all shifted x meters to for the right side and a third set 
> shifted -x meters for the left side.


does not matter much as eventually you will have even more nodes when
people
come back and start drawing the polygons of the buildings. 

Marcus




More information about the talk mailing list