Gdal is known for being the fastest library for geospatial data processing. I'm using it in my python script and I'm having issues with performance on a specific task which is Erasing a layer from another layer which takes too much time!
I used first this prebuilt function:
This works fine for a layer with average number of objects but when running it with a layer that has a 200,000 features it takes forever!
So I managed to write this bit of code:
for featureI in inputLayer: geomI = featureI.GetGeometryRef() maskLayer.SetSpatialFilter(geomI) for featureM in maskLayer: geomM = featureM.GetGeometryRef() featureI.SetGeometry(geomI.Difference(geomM)) selfLayer.SetFeature(featureI)
But this will last 1200 min which is too long for my case!
Is there any way to speed things up? Do you have any suggestions to make for me?
I'm using python3.5 with GDAL2,