Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#4590 closed defect (fixed)

Minor problem with OGR clipping (input parameters robustness)

Reported by: egrosso Owned by: warmerdam
Priority: normal Milestone: 1.9.1
Component: default Version: 1.9.0
Severity: normal Keywords: OGR, clipping, input parameters, robustness
Cc:

Description

If the filename of the polygon which is used to do the clipping begins with "polygon" or "multipolygon" based on "ogr2ogr -clipsrc arg1 arg2 arg3" piece of code, the algorithm tries to convert the argument arg1 in WKT. Exemple: ogr2ogr -clipsrc polygon_selection.shp output.shp input.shp

The following error is displayed: "FAILURE: Invalid geometry. Must be a valid POLYGON or MULTIPOLYGON WKT"

Here is the code extract of ogr2ogr.cpp which is linked to this problem (same for -clipsrc and -clipdst options):

else if (EQUALN(papszArgv[iArg+1], "POLYGON", 7)
EQUALN(papszArgv[iArg+1], "MULTIPOLYGON", 12))

Change a bit the code, e.g. "POLYGON", 7 becomes "POLYGON(", 8, could do the trick.

Change History (2)

comment:1 by Even Rouault, 12 years ago

Milestone: 1.9.1
Resolution: fixed
Status: newclosed

Fixed in trunk (r24170) and in branches/1.9 (r24171)

comment:2 by Even Rouault, 12 years ago

Also fixed for -clipdst in trunk (r24202) and branches/1.9 (r24203)

Note: See TracTickets for help on using tickets.