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: &quot;FAILURE: Invalid geometry. Must be a valid POLYGON or MULTIPOLYGON WKT&quot;</div><div><br></div><div>I checked my polygon_selection.shp file. It was &quot;OGC&quot; 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 &quot;polygon&quot; or &quot;multipolygon&quot;, 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], &quot;POLYGON&quot;, 7) || EQUALN(papszArgv[iArg+1], &quot;MULTIPOLYGON&quot;, 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. &quot;POLYGON&quot;, 7 becomes &quot;POLYGON(&quot;, 8 could do the trick). That&#39;s why I didn&#39;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>