[OSM-talk] JOSM dual-carriageway feature - patch

matthew-osm at newtoncomputing.co.uk matthew-osm at newtoncomputing.co.uk
Fri Jan 19 23:48:58 GMT 2007


Hi Imi and all,

I've written a new feature for JOSM that allows you to tidy up
dual-carriageways. It sets nodes to be the correct distance from each other, and
aligns them so that they are in pairs along the ways.

Patch is at: http://dl.newtoncomputing.co.uk/josm198_equidist_ways.patch
Icon is: http://dl.newtoncomputing.co.uk/equidist.png
Patched JOSM is at: http://dl.newtoncomputing.co.uk/josm-equidist.jar

The tool can be operated with three different types of objects selected:

* 2 nodes - then the nodes are just set to the correct distance from each other

* 2 ways - each pair of nodes in the way are set to the correct distance

* 2 ways and other nodes - same as before, but the selected nodes are ignored

Ways can be of different lengths. There is a bit of intelligence to try and pick
the right starting pair of nodes, although this is not foolproof. It should work
in most cases, though.

The above will fail where a way has nodes that are not in pairs, maybe such as
where a sliproad joins a dual-carriageway. In this case, select both the ways
and the node that is on its own - this node will then be ignored by the
algorithm.

Hope this is useful - I've been testing it on several roads (I've begun to tidy
the A14 with it) and it makes the ways very neat... you know if it didn't work
or if there are nodes not in pairs as things to go visibly wrong ;-). It should
be used in conjunction with the original GPX data, of course. It's not finished
quite yet, and there are maybe bugs, but I think it is OK for inclusion in JOSM
now if you would like.

Thanks,

Matthew


(Original talk announcement follows, which is now out of date - comments below
where appropriate.)

On Sat, Jan 13, 2007 at 08:42:39PM +0000, matthew-osm at newtoncomputing.co.uk wrote:
> Hi,
> 
> I've been working on a feature for JOSM to auto-align the distance of nodes on
> dual-carriageways. You can currently do the following:
> 
>   a) Select two nodes - they will be be set to a set distance apart from each
>      other.
> 
>   b) Select two ways - each pair of nodes in the ways will be set to a set
>      distance apart from each other.
> 
> This is obviously intended, like the Align in Circle patch, for when you have
> the underlying data and can make sure things are placed in the correct
> positions. Please don't use it on roads where you don't know that the
> carriageways don't diverge from each other...
> 
> Currently there are some limitations. Notes are below:
> 
> * the distance is fixed - it is nominally 30 metres, if my great circle distance
>   calculations are correct. There should be a dialog that allow this to be set.

out of date - this can be set in the advanced preferences with equidistance.dist
- in metres, nominally.


> * node distances are set, but the nodes are not rotated. I have worked out an
>   algorithm and this will be implemented next. This means that things can look a
>   bit distorted if nodes are not fairly well placed initially.

not correct now - this works quite well.


> * ways of differing lengths and/or different numbers of nodes may have unusual
>   results. There are semi-plans for ignoring parts of ways that are not
>   relevant. However, nodes should generally be in pairs along the way already
>   otherwise it will break. Currently one end of the ways must be aligned.
> 
>   this will work:
> 
>   *---->*----->*---------->*------->*-------->*
>   *----->*---->*--------->*--------->*
> 
>   this will break:
> 
>   *---->*----->*---------->*------->*-------->*
>          *---->*--------->*--------->*

not any more, but be careful.


> * ways with branches are not supported - they must be paths. I do not consider
>   this to be a bug ;-)
> 
> * you might see some dialog boxes with debugging info in; to be removed.

should not happen now.


> JOSM 191 with the patch is available from the below location, as well as the
> patch itself. Suggestions/patches to improve the code please - I'm not a Java
> programmer, and get very worked up that I could code it 90% less lines in perl
> ;-)
> 
>   http://dl.newtoncomputing.co.uk/josm191_equidist_ways.patch
>   http://dl.newtoncomputing.co.uk/josm-equidist.jar

-- 
Matthew




More information about the talk mailing list