1

I am trying to automate a process of a shapefile. We are using Google Maps engine and we have limitation on number vertices in a shapefile. So I am using a grid to split the shapefiles.

In GUI , I add a grid from research tool then vector->geoprocessing->intersect and get the result but when I try it using API ( with below code ) result is not same. it gives me error as it cannot insert LINESTRING in POLYGON shapefile. this is my code:

QgsApplication.setPrefixPath('C:\\OSGeo4W\\apps\\qgis', True)
QgsApplication.initQgis()
covLayer = QgsVectorLayer('C:\\Shapes\\small coverage.shp','coverage','ogr')
gridLayer = QgsVectorLayer('C:\\Shapes\\small grid.shp','grid','ogr')
qgis.analysis.QgsOverlayAnalyzer().intersection(gridLayer,covLayer,'C:\\Shapes\\intersected.shp',False)
QgsApplication.exitQgis()

Any insight?

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.