mbloch / mapshaper

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

Clean Polygons & add gap areas to a specific layer #458

Open mkieselmann opened 3 years ago

mkieselmann commented 3 years ago

Hi,

first of all thanks for building mapshaper. Its such an incredible tool with so many cool commands. I am probably missing the correct the way to do the following:

I have two layers of polygon mosaic data. The layers are non-overlapping and form another mosaic (each layer contains data for some counties). Unfortunately, one of the layer is simplified while the other contains precise data.

My goal is to merge the two layers in order to form a clean mosaic of polygons. The gap areas between the simplified layer and the precise layer should be dissolved into the polygons in the simplified layer only, not to the precise layer. Is this possible with with mapshaper?

Bildschirmfoto 2020-12-28 um 18 38 35

I already tried the following:

Use dissolve2 to remove gaps and overlaps

mapshaper -i <simplified> <precise> combine-files -merge-layers -dissolve2 id gap-fill-area=7km2

Unfortunately, gaps areas are dissolved into both layers, even though the polygons in precise layer are smaller than the ones in the simplified layer (wiki says that gaps are merged into the largest neighbor polygon)

Remove overlaps - Create gap polygons - Dissolve gaps with simplified layer

  1. mapshaper -i <simplified> erase <precise> -o <simplified_1> -> removes overlaps of the simplified layer
  2. mapshaper -i <simplified_1> <precise> combine-files -merge-layers -dissolve2 id gap-fill-area=7km2 -> creates gap area polygons
  3. Now I don't know how to merge gap area polygons with their closest neighbor polygon in the layer
redimongo commented 2 years ago

I would like to know how to fill in a gap too