I am running a standalone script for QGIS which creates a high resolution grid and clips shapefiles onto it. Works perfect if the cell width and height have a high values (in my case, >200m for both). Anything lower than this and I suddenly get the following error:
ERROR 1: Attempt to write non-polygon (POINT) geometry to POLYGON type shapefile.
I have read this post with a similar problem, and as mentioned in the answer, the results I obtain are correct so I am not worried about that.
Is there a method to remove this error message(s) from appearing? It looks incredibly messy:
I've also included a stripped-down snippet of code I use:
def run(): Cellsize = 10 layerPath = "path\to\shapefile" extent = QgsVectorLayer( layerPath, '', 'ogr' ).extent() centerx = (extent.xMinimum() + extent.xMaximum()) / 2 centery = (extent.yMinimum() + extent.yMaximum()) / 2 width = extent.xMaximum() - extent.xMinimum() height = extent.yMaximum() - extent.yMinimum() outputs_0=general.runalg("qgis:creategrid", Cellsize, Cellsize, width, height, centerx, centery, 1, 'EPSG:7405', None) outputs_1=general.runalg("qgis:clip", outputs_0['SAVENAME'], "path\to\shapefile", "create\path\for\result") try: run() except Exception: pass