How to patch multiple polygon vector maps cleanly in GRASS GIS
The v.patch module does an excellent job patching multiple polygon vector maps, but it sometimes leaves areas without centroids. Here, I’m sharing what I do to clean the topology of v.patch outputs. Let’s say I want to patch 5 subbasin polygon vector maps from subbasin1,...,subbasin5. I start patching them into one vector map.
v.patch input=subbasin1,subbasin2,subbasin3,subbasin4,subbasin5 output=subbasins
If I’m lucky, v.info should report the same number of areas and centroids. If it’s not the case, you need to clean the output vector map. First, break boundaries at intersections, remove duplicate features, small angles, and duplicate area centroids.
v.clean input=subbasins output=tmp tool=break,rmdupl,rmsa,rmdac
Add missing categories to areas. After running this command, there should be the same number of areas and centroids.
v.category input=tmp output=tmp2 option=add type=area
However, at this point, there are duplicate categories, so recategorize all centroids. Remove existing categories first.
v.category input=tmp2 output=tmp3 option=del cat=-1
Restart from 1 and save the output as the final vector map.
v.category input=tmp3 output=subbasins option=add