0

I'm very beginner in QGIS and I want to erase Features by using PyQGIS. I have written this code. So far, it give me the geometry of each feature polygon layer, but I don't know how to erase it through coding?

layer = iface.activeLayer() #get active layer
for f in layer.getFeatures():
  geom = f.geometry()
  print geom.asPolygon() #get polygon

enter image description here

As picture suggested, a big polygon contains small polygon. I want to erase all small polygons in that same layer so if i move small polygon after erase hallow will be shown in big polygon.

  • How do you want to split it? With another layer? – Liam G Aug 31 '16 at 13:33
  • @Freight_Train no within same layer – Muhammad Faizan Khan Sep 1 '16 at 4:50
  • I dont want to create any other layer just want to split and hallow the layer. actually in layer there is a big polygon which includes small polygons. i want to split them – Muhammad Faizan Khan Sep 1 '16 at 4:50
  • Do you want to split each feature or cut holes in the containing polygon with using the geometry of the smaller polygon? – Liam G Sep 1 '16 at 4:55
  • split feaures work like cut. i want to retain splitted polygon. – Muhammad Faizan Khan Sep 1 '16 at 4:57

Your Answer

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

Browse other questions tagged or ask your own question.