3

The GADM is a great resource from global boundaries of countries, states and municipalities. The amount of detail is suitable for many analyses but when it comes to mapping or displaying it is often sufficient to display a simplified version.

I am struggling to create a simplified set of the GADM level 0 boundaries in QGIS using the grass generalize (v.generalize) function.

Objective:

  1. Reduce total size of the file from ~500MB to <100MB
  2. Create matching boundaries between countries. No weird empty space between polygons

so far I haven't been able to find the right settings of the function.

I am aware of the following resources:

3

You first need to import GADM into GRASS GIS 7 with a snapping threshold of 1e-7 due to topological errors in the original data set (see also https://grasswiki.osgeo.org/wiki/Importing_large_GADM_vector_data). Then you can run v.generalize for simplification and export the new map.

Example procedure (obviously you can also use the graphical user interface!):

# create new project ("location") from dataset
grass72 -c gadm2.shp $HOME/grassdata/latlong_gadm2

# start GRASS GIS with this new location (lat-long)
grass72 $HOME/grassdata/latlong_gadm2/PERMANENT

# import data, snap on the fly to fix topological errors:
v.import input=data/gadm2/gadm2.shp output=gadm2_clean snap=1e-7

# generalize = simplify vectors with Douglas-Peucker. We try 0.002 threshold:
v.generalize input=gadm2_clean output=gadm2_simplified method=douglas threshold=0.002
  ...
  WARNING: 30630 boundaries were not modified because modification would
     damage topology
  WARNING: 4027 lines/boundaries were not modified due to over-simplification
  ...
  v.generalize complete. Number of vertices for selected features
  reduced from 43585132 to 12510645 (28% remaining)

# export to SHAPE, now topologically clean
v.out.ogr input=gadm2_simplified output=gadm2_simplified.shp

The resulting SHAPE file is a fraction in size of the original SHAPE.

If needed, check the GRASS GIS Quickstart.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.