I have a polygon dataset (shapefile, mapinfo tab file) which I would like to "clean" to be topologically correct. The polygons are assigned an ID which represents a specific class. For example ID 3 is forest and ID 2 is grass. In general the polygons does not touch or overlay but there are some exceptions. For example, a small polygon, forest, is on top of a larger polygon, grass. What I would like to do is to have a hole in the grass polygon where the forest polygon intersects.
What I have tried thus far was the v.clean tool in QGIS/grass plugin. But for some reason it also creates a grass polygon the same size as the forest polygon. So instead of two polygons there are three polygons. The images below illustrate what I have, what I want, what I would like and what the v.clean tool does.
Illustrates the tree polygon on top of the grass polygon
The forest polygon moved to illustrate that the grass polygon does not have a hole
The result from v.clean. Three polygons and a hole.
There are about 100 000 000 polygons (not all in one file) so doing it manually is not an option. I have arcmap and mapinfo but would like an opensource (QGIS/greass/saga/postgis/python script) to clean the polygons. Any suggestions?