farmOS / farmOS-map

farmOS-map is an OpenLayers wrapper library designed for agricultural mapping needs. It can be used in any project that has similar requirements.
https://farmOS.github.io/farmOS-map
MIT License
37 stars 22 forks source link

Support drawing polygons with cutouts #123

Open mstenta opened 3 years ago

mstenta commented 3 years ago

This came up in a recent conversation...

It's possible to represent a polygon in WKT that has another polygon cut out from it. For example, see the second polygon example on https://en.wikipedia.org/wiki/Well-known_text_representation_of_geometry

POLYGON ((35 10, 45 45, 15 40, 10 20, 35 10),
(20 30, 35 35, 30 20, 20 30))

It would be great if the farmOS map edit control had the ability to produce these kinds of polygons.

Currently, if you draw two polygons, it will output a GEOMETRYCOLLECTION of multiple POLYGONs.

I'm not sure how this would work, in terms of the button controls... open to ideas!

gbathree commented 3 years ago

Yes! This is an issue that we have, it's also really important for certification or environmental service market applications (carbon sequestration, etc.) because a precise measure of the 'worked' field is important.

While there are several options... I think it's just a separate UI element. I'd argue that without that cutout image (see below for example) users are never going to figure out (with lots of ineffective explanatory text) what 'cutout' means.

In SurveyStack, we allow survey creators to turn on or off the UI elements... so in our case, a survey creator could just turn off cutouts if they wanted, or leave it on if they could handle it in however they were managing it.

Screenshot from 2021-06-23 15-41-08

That's my two cents!

symbioquine commented 2 years ago

I'm not totally convinced it it would be preferable, but in theory another way this could work would be allowing both/multiple polygons to be selected with the edit tool and - if they touch/intersect - show some boolean operations. e.g. "merge", "difference", "intersection", etc.

The big advantage of this strategy is the feature could always be there, but only advanced users would know how to get to it. i.e. you'd have to hold shift and select multiple intersecting features before those buttons would show up. Obviously it could still be documented, but it wouldn't need to take up screen space all the time.