Opened 10 years ago
Closed 4 years ago
#11265 closed enhancement (fixed)
[PATCH] Measure area made of several segments
Reported by: | 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)
Change History (8)
by , 10 years ago
Attachment: | measure-areas.diff added |
---|
comment:1 by , 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 , 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 , 10 years ago
Cc: | added |
---|
comment:4 by , 6 years ago
Summary: | Measure area made of several segments → [PATCH] Measure area made of several segments |
---|
comment:5 by , 6 years ago
Cc: | 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 , 4 years ago
I think this ticket can be closed, the plugin seems to work as suggested.
comment:7 by , 4 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Measure areas made by several adjacent ways