[gdal-dev] [BULK] Re: Dissolve shapefile using GDAL/OGR
Mike Toews
mwtoews at gmail.com
Mon Jul 14 16:12:21 PDT 2014
The path strings are not escaped, so dissolve[13] is '\a' or '\x07'
and not 'a', which makes the path invalid.
For Windows paths, the best practice is to either use forward slashes
(like unix), or use raw escape with r as a string prefix, e.g.
dissolve = r'C:\OSGeo4W64\apps...'
On 12 July 2014 02:21, kalu671 <kalu671 at gmail.com> wrote:
> Hello Dan,
> I tried to use the syntax and I am getting the error:
> "The filename, directory name, or volume label syntax is incorrect."
>
> my syntax is as below:
> inFile = "D:\Dir1\Polygons.shp"
> outFile = "D:\Dir2\Dissolved_polygons.shp"
>
> dissolve = 'C:\OSGeo4W64\apps\saga\saga_cmd shapes_polygons "Polygon
> Dissolve" -POLYGONS = ' + inFile + ' -DISSOLVED = ' + outFile + ' -FIELD_1=
> Value -DISSOLVE= 0'
>
> subprocess.call(dissolve, shell=True)
>
> Would you please suggest what did I do wrong?
>
> Thanks
More information about the gdal-dev
mailing list