mbloch / mapshaper

Tools for editing Shapefile, GeoJSON, TopoJSON and CSV files
http://mapshaper.org
Other
3.78k stars 535 forks source link

GUI use case: Manually select features and derive field / dissolve #531

Closed gordonje closed 2 years ago

gordonje commented 2 years ago

First of all, thank you so much for sharing your work with the world. I am finding it invaluable.

I have a use case wherein a colleague needs to define multiple, non-overlapping custom geographies (calling them "Regions") by selecting adjacent features in a GeoJSON file. The smaller geographies are towns.

My best current plan is to have them define the mapping between the towns and regions in a csv file. Then use mapshaper to select and dissolve those polygons into new ones. Or maybe add a new attribute (e.g., regionID) to the existing features.

I would like to provide my colleague a GUI for doing this, and I'm wondering if mapshaper (or some implementation of it) would be up to the task. Like I was imagining I could hold shift and click on each feature (or even better drag the cursor across them) to select the towns, then use the console for the next steps.

I would very much appreciate any advice, examples or resources you could provide.

gordonje commented 2 years ago

Actually, just realized I could use "select features" (instead of "inspect features") to click on multiple features at a time. Thanks again for a truly amazing utility!

mbloch commented 2 years ago

The "select features" tool does support multiple-feature selection... but the selection tool doesn't help that much with the use case that you described, right? What if you could select multiple features and then give the selected features the same attribute value? Then you could use the -dissolve or -dissolve2 command to dissolve each group of shapes (e.g. -dissolve groupname).

The simplest way to add this functionality might be to add multi-selections to the "edit attributes" tool, which currently only lets you select one feature at a time (see screenshot).

image

gordonje commented 2 years ago

What if you could select multiple features and then give the selected features the same attribute value?

This would definitely be a great feature that would help my use case.

Multi-selections under "edit attributes" would work. Also, the ability to add an attribute under "shift-drag box tool" would be great.

I can still do what I need to do right now by following a workflow suggested by here.