Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ogr2ogr parameter -clipdst duplicated #29

Open
dschoenig opened this issue Apr 20, 2020 · 0 comments
Open

ogr2ogr parameter -clipdst duplicated #29

dschoenig opened this issue Apr 20, 2020 · 0 comments

Comments

@dschoenig
Copy link

dschoenig commented Apr 20, 2020

When trying to use ogr2ogr() with the clipdst parameter the resulting call to the ogr2ogr utility includes -clipdst twice, which results in an error.

Minimum example (adapted from the ogr2ogr() example):`

src_datasource_name <- system.file("external/tahoe_highrez_training.shp",
                                   package="gdalUtils")
dst_datasource_name <- paste(tempfile(),".shp",sep="")

# reproject and clip to destination bounding box
ogr2ogr(src_datasource_name, dst_datasource_name,
        t_srs="EPSG:3395",
        clipdst = "-13350800 4736200 -13350700 4736400",
        verbose = TRUE)
# Call provided -clipdest twice and fails with error:
# ERROR 6: Unknown option name '-13350800 4736200 -13350700 4736400'

# No output file
ogrinfo(dirname(dst_datasource_name),
        layer=remove_file_extension(basename(dst_datasource_name)))

# Corresponding system call results in expected behaviour (i.e. providing -clipdst only once):
system(paste("/usr/bin/ogr2ogr",
             "-t_srs EPSG:3395",
             "-clipdst -13350800 4736200 -13350700 4736400",
             dst_datasource_name,
             src_datasource_name))

# Output successfully created
ogrinfo(dirname(dst_datasource_name),
        layer=remove_file_extension(basename(dst_datasource_name)))

# Cleanup
file.remove(dst_datasource_name)

Tested with GDAL version 2.4.2 and R version 3.6.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant