[josm-dev] Validator plugin WronglyOrderedWays false error

Roy Rankin rrankin at ihug.com.au
Sun May 11 08:58:47 BST 2008


The validator plugin was giving a false error on a lake with a clockwise 
way. When I looked at the code, I found the code locates the most 
northern point of the way and then looks at the next point and if it is 
east of the north point the way is considered to be clockwise. In my 
case the northern point of the clockwise way was also the most eastern 
point so it considered the way counter-clockwise.

I have done a rewrite of the code as follows:

  Determine the mean latitude of the closed way.
  Then add the deltas of longitude for each segment starting with
  a latitude greater than mean and subtract the deltas of longitude
  if the start is less than the mean latitude.

   The result should be positive for clockwise ways and negative
   for counter-clockwise ways.

This may still incorrectly determine the direction of the way in some 
cases, but should be much more reliable then before.

I also noticed the validation error result labels were not correct and 
fixed this error.

Attached are my changes.

Regards,
Roy Rankin
           *




More information about the josm-dev mailing list