2009/4/7  <marcus.wolsc...@googlemail.com>:
> On Mon, 6 Apr 2009 21:08:15 -0400 (EDT), Steve Singer
> <ssinger...@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 );

If you just add the normal vectors it won't look very natural because
the angle will determine the offset between the interpolation way and
the road.
> }
>
> Node endInterpNode = new Node(w.getNode(last).location +
>   offset * w.getNode(last).getLastSegment().vectorNormalLeft());
>
> }
>
> Not as difficult as andrzej thought it would be.

This isn't the difficult part, ump2osm implements this too.  The
difficult part is the reverse mapping, if you wanted to convert OSM
data back into a Garmin compatible format.
(difficult but doable, ofcourse)

Cheers

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

Reply via email to