hotosm / fmtm

Field Mapping Tasking Manager - coordinated field mapping.
https://fmtm.hotosm.org/
GNU Affero General Public License v3.0
44 stars 44 forks source link

Option to merge geoms for AOI splitting during project creation #1282

Open spwoodcock opened 7 months ago

spwoodcock commented 7 months ago

Is your feature request related to a problem? Please describe.

Describe the solution you'd like

Describe alternatives you've considered

Additional context

Requirement from an actual mapping campaign in Liberia.

spwoodcock commented 7 months ago

Related to #1263

We should probably have a configuration section in place on the frontend if the user selects the splitting algorithm.

Sujanadh commented 7 months ago

I think I did this long ago using an approach to splitting each individual polygon from a multipolygon by passing a polygon at a time to the algorithm, which splits it and appending the results of every polygon.

spwoodcock commented 7 months ago

Yes I think the code is there to loop through geoms and return a list of FeatureCollections 👍

The issue is that often by processing separately the geom does not have enough polyline data within it to split correctly.

The best solution is improving the splitting algorithm so it doesn't need polylines. If none are present then the features are simply divided up using the 'num buildings' param.

We should probably also provide a configuration to merge the geoms before splitting, if the user wishes.

Sujanadh commented 3 months ago

For now, if user uploads two polygons where they are touched or overlapping as an AOI, and still chooses to split task we combine those polygons making a single polygon and allow splitting Again, if those polygons are disjoint we dissolve those polygons and create new boundary as an aoi and allow splitting if they choose task split. Input Polygons image

Output image

task-split image

Sujanadh commented 3 months ago

@spwoodcock

spwoodcock commented 3 months ago

Does this already exist? Nice if so, we can close the issue!

spwoodcock commented 3 months ago

Yeah I think this is all good 👍

I uploaded a multipolygon AOI and successfully generated an extract.

image

I then ran the splitter:

image

Sujanadh commented 3 months ago

yes, it does allow splitting but there is still an issue while creating the project with this type of AOI, since we don't accept multipolygon as a project AOI.

Sujanadh commented 3 months ago

There is slight issue while merging polygons; we perform unary_union if the polygon is mulitpolygon , but if the polygons are disjoint then it will again results into MultiPolygon type, so in order to handle that we need to dissolve those polygons and create new boundary with a single polygon.

Sujanadh commented 3 months ago

image This what it looks like while splitting task using disjoint polygon. if we want to dissolve the polygons and split it , it will look like this: image so if we want to handle splitting like the first one , we should allow db to save multipolygon aoi also. if not we need to apply convex hull to dissolve the polygons and create a single Polygon like the second one.

Sujanadh commented 3 months ago

Or we can split like the 1st case , but make project aoi like the 2nd case by using separate merging process.