Eric, If you could file a ticket on the issue we can make the "looks like a geometry" logic more bulletproof.
Best regards, Frank On Wed, Mar 28, 2012 at 7:27 PM, Eric Grosso <[email protected]> wrote: > Hi, > > I was writing a small OGR based script (bash) in order to clip several > shapefiles at the same time. > Thus I used this piece of code: ogr2ogr -clipsrc polygon_selection.shp > output.shp input.shp > > Using it, I had the following error: "FAILURE: Invalid geometry. Must be a > valid POLYGON or MULTIPOLYGON WKT" > > I checked my polygon_selection.shp file. It was "OGC" valid. Then I checked > the documentation. Apparently it was correct. > So I finally decided to check the code and I understood why I had this > message. > > If the filename of the polygon which is used to do the clipping begins with > "polygon" or "multipolygon", the code tries to convert > this argument in WKT. > > Here is an code extract of ogr2ogr.cpp (same for -clipsrc and -clipdst > options): > > else if (EQUALN(papszArgv[iArg+1], "POLYGON", 7) || > EQUALN(papszArgv[iArg+1], "MULTIPOLYGON", 12)) > > > I let you decide what to do (add this very minor problem to the > documentation or change a bit the code, > e.g. "POLYGON", 7 becomes "POLYGON(", 8 could do the trick). That's why I > didn't open any bug report or enhancement request. > > First time I write on this list, so I catch the opportunity to thank all the > developers of GDAL/OGR for your wonderful work. > > Cheers, > Eric > > _______________________________________________ > gdal-dev mailing list > [email protected] > http://lists.osgeo.org/mailman/listinfo/gdal-dev -- ---------------------------------------+-------------------------------------- I set the clouds in motion - turn up | Frank Warmerdam, [email protected] light and sound - activate the windows | http://pobox.com/~warmerdam and watch the world go round - Rush | Geospatial Software Developer _______________________________________________ gdal-dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/gdal-dev
