Modify

Opened 10 years ago

Closed 4 years ago

#11265 closed enhancement (fixed)

[PATCH] Measure area made of several segments

Reported by: me@… Owned by: team
Priority: normal Milestone:
Component: Plugin measurement Version:
Keywords: area relation Cc: naoliv, GerdP

Description

We are building relations made of several ways that meet end-to-end. Together these ways make up a single closed loop. It would be very useful if selecting all the ways (or just selecting the relation) would report the total area of the closed loop. Thanks!

Attachments (1)

measure-areas.diff (3.3 KB ) - added by me@… 10 years ago.
Measure areas made by several adjacent ways

Download all attachments as: .zip

Change History (8)

by me@…, 10 years ago

Attachment: measure-areas.diff added

Measure areas made by several adjacent ways

comment:1 by me@…, 10 years ago

Here is an initial attempt.

A node called areaStartNode stores the first node in a possible area. At the end of measuring each way, we check to see if the lastNode in the way is the same as the areaStartNode. If so, we've found a closed loop and can add the calculated area to the final area, and areaStartNode is reset.

If we start a new way and the first node is not the same as the lastNode from the previous way, then the ways aren't joined; areaStartNode is reset and wayArea goes back to zero.

Note that this will only report a correct result when the ways are selected in order. Out of order, and the area will not be detected and the result will be zero. For a single closed area this will be obvious to the user, but if they've selected several areas (some in order, some not) then the error may not be obvious. I'm not sure if this is a serious enough limitation. A refinement could be to try sorting the ways to produce measurable areas every time.

comment:2 by anonymous, 10 years ago

Okay, so another limitation is that two ways that make an area must be the same way around (i.e. head to tail), or it doesn't detect the area. May need a lot more thinking here.

comment:3 by naoliv, 10 years ago

Cc: naoliv added

comment:4 by Don-vip, 6 years ago

Summary: Measure area made of several segments[PATCH] Measure area made of several segments

comment:5 by Don-vip, 6 years ago

Cc: GerdP added

I started to add multipolygon support in [o35047:35048] (I was surprised it was not handled already). The plugin can probably be simplified/optimized by calling more JOSM core geometry functions.

comment:6 by GerdP, 4 years ago

I think this ticket can be closed, the plugin seems to work as suggested.

comment:7 by Don-vip, 4 years ago

Resolution: fixed
Status: newclosed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.