[OSM-dev] JOSM patch: align nodes in a circle

matthew-osm at newtoncomputing.co.uk matthew-osm at newtoncomputing.co.uk
Sat Sep 16 02:09:59 BST 2006


On Sat, Sep 16, 2006 at 01:53:42AM +0100, Robert Hart wrote:
> 1. You say "Please select at least two nodes", but of course your algorithm
> does nothing with two points (as they must be equidistant from their own
> average location). 

Good point... it was initially to ensure the function didn't break, rather than
thinking about what was sensible. I guess three is a better value.

> 2. Related to the first. With three points, there obviously *is* a circle
> that passes through all three points, so you could argue that the nodes
> shouldn't move. This also means your algorithm could behave unexpectedly on
> any set of nodes that already lie on a circle, but that are not evenly
> distributed around it. I doubt anybody would notice this ever.

Yes, it does behave "unexpectedly" in this regard; repeating the method on the
same nodes gradually makes the nodes more equidistant around the circle (and of
course moves the circle slightly as well, as the average centre is different
each time). Maybe this is a "feature" rather than a bug! Hence my comment it has
to be used carefully (i.e. always in reference to underlying GPS track points).

> 3. Will this produce true circles at any latitude? (i haven't looked at how
> JOSM handles coordinates/distances internally)

Good point, don't know. My guess is that they are circular to the projection (in
my case Mercator) rather than in reality. It seems fine in the South and
Midlands of the UK. Maybe someone has gps logs of a roundabout in Alaska or
Siberia and can check it? ;-)



More information about the dev mailing list