I want to clip a shapefile to a shapefile. The input shapefile is a 1 m vector grid generated in QGIS. The tile I'm clipping to is just a simple polygon (the geometry is contained within the 1 m vector grid).
I put into the command line:
ogr2ogr -overwrite -t_srs EPSG:27700 -clipsrc ./Crewe_boundary_tile_grid_ID__0.shp ./Crewe_boundary_1m_grid_clipped_ID__0.shp ./Crewe_boundary_1m_grid.shp
However I get the error message:
ERROR 1: Attempt to write non-polygon (LINESTRING) geometry to POLYGON type shapefile. ERROR 1: Unable to write feature 500 from layer Crewe_boundary_1m_grid.
ERROR 1: Terminating translation prematurely after failed translation of layer Crewe_boundary_1m_grid (use -skipfailures to skip errors)
Yet if I try and run this for a different shapefile, i.e. a simple rectangular polygon, it works. I have also used exactly the same command on a 1000 m grid and that works. Also, if I do 'ogrinfo' then each of the input files reads as a polygon.
How do I fix this?