Hi,<div><br></div><div>I was writing a small OGR based script (bash) in order to clip several shapefiles at the same time.</div><div>Thus I used this piece of code: ogr2ogr -clipsrc polygon_selection.shp output.shp input.shp</div>
<div><br></div><div>Using it, I had the following error: "FAILURE: Invalid geometry. Must be a valid POLYGON or MULTIPOLYGON WKT"</div><div><br></div><div>I checked my polygon_selection.shp file. It was "OGC" valid. Then I checked the documentation. Apparently it was correct.</div>
<div>So I finally decided to check the code and I understood why I had this message.</div><div><br></div><div>If the filename of the polygon which is used to do the clipping begins with "polygon" or "multipolygon", the code tries to convert</div>
<div>this argument in WKT.</div><div><br></div><div>Here is an code extract of ogr2ogr.cpp (same for -clipsrc and -clipdst options):</div><div><pre style="word-wrap:break-word;white-space:pre-wrap">else if (EQUALN(papszArgv[iArg+1], "POLYGON", 7) || EQUALN(papszArgv[iArg+1], "MULTIPOLYGON", 12))</pre>
<div><br></div></div><div>I let you decide what to do (add this very minor problem to the documentation or change a bit the code,</div><div>e.g. "POLYGON", 7 becomes "POLYGON(", 8 could do the trick). That's why I didn't open any bug report or enhancement request.</div>
<div><br></div><div>First time I write on this list, so I catch the opportunity to thank all the developers of GDAL/OGR for your wonderful work.</div><div><br></div><div>Cheers,</div><div>Eric</div>