[OSM-talk] non-linear ways
    Simon Hewison 
    simon at zymurgy.org
       
    Mon May 15 18:30:58 BST 2006
    
    
  
I've started writing a sanity checking script that will locate ways with 
  non-linear segments, yet look like a straight line.
Working from the latest planet.osm extract, it's already found some.
For instance, it's identified the Charlbury and Finstock footpath as 
being non-linear. (way id 240783)
(bounding box containing it)
-1.4954201009168266,51.857085117753876,-1.4734848258813946,51.86860919736889
It's non-linear because if you follow the direction of the segments as 
they are laid down, some of them are facing 'backwards'.
This isn't very important for footpaths (though it helps Osmarender to 
label correctly), but it's pretty much vital for motorways and one-way 
streets, when route planning software starts looking at "oneway" labels)
These are rather obvious when you look at this in a recent JOSM with the 
arrowheads turned on.
I'll soon work out how to get it to automatically prepare a correction 
for these (having first confirmed the data is up-to-date as per the 
api), to be applied via the API.
The criteria is:
The way should be an ordered list of segments
All nodes of all segments are referenced only once in the list[1]
The "to" attribute on a segment should match the "from" on the next 
segment on the way.
This means that either: the way isn't ordered correctly
or: one or more segments in the way need turning around.
[1] probably need to deal with nodes that are referenced more than once 
in any way and deal appropriately, for instance, at complicated road 
junctions.
Once I've done that, I may well want to see about getting a script to 
normalise the tags, so that for instance:
class=footpath
class=walking path
highway=footpath
all become
highway=footway
This might be a little contentious, since people already have code 
working on "old" keys and values, so I might get it to supplement the 
tags with the "new" ones.
-- 
Simon Hewison
    
    
More information about the talk
mailing list