How to split out regions with Mapshaper
To split regions into subregions, you can use the free online tool Mapshaper. In this tutorial, we will be splitting out the Balearic islands so each of the islands is its own region, instead of them being grouped into provinces.
Upload your GeoJSON file to Mapshaper. https://geojson-maps.ash.ms/ is a great resource to get public domain GeoJSON files from Natural Earth.
TIP: Struggling to find the right regions for your map? Check out our GeoJSON repository where we've sourced, checked, and resized various region files ready for you to download and use in Flourish.
- Use the select features tool to select the regions you would like to split out. Once you've selected your group of regions, choose Split from the options that appear in the upper area of the editor.
- Once you've split out your regions, they will appear greyed out. If you click on the dropdown where the name of your GeoJSON is displaying, you'll see they've been moved to a separate layer. Click into that layer.
Now it's time to
explodeyour grouped regions into their own subregions. To do this, open the mapshaper console (while in the newly generated layer) and enter
mapshaper explode. This command will convert multipart lines or polygons into singlepart lines or polygons – so essentially split a region consisting of three islands into three single regions each consisting of one island.
- Now you can give each of the newly created singlepart polygons a new name by using the Edit attribute tool and writing the new name of the region in the text field that pops up when you click on your new region.
- Repeat this for as many grouped regions you'd like to split out. Each will receive their own new layer.
Once you're done splitting them out to a new layer and exploding there, it's time to merge them back together. To do this, open the console and run the command
merge-layers target=region1,region2 force. (Replace
region2with the names of your regions.) Keep merging the split out layers back into the master layer one by one, until you only have one layer again.
- Once you have one layer, you can export that as a GeoJSON file and import it to Flourish.