On Sun, May 11, 2008 at 9:58 AM, Roy Rankin <[EMAIL PROTECTED]> wrote: > 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.
You're almost there. You should just use the proper formula for the area of a polygon: for each node area += x*deltay - y*deltax Dont' need to calculte the mean, nor test anything for direction. And 100% relaible (for non-self-intersecting polygons anyway). Have a nice day, -- Martijn van Oosterhout <[EMAIL PROTECTED]> http://svana.org/kleptog/ _______________________________________________ josm-dev mailing list [email protected] http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/josm-dev
