ogr2ogr {gdalUtilities} | R Documentation |
Interface to GDAL's ogr2ogr utility
Description
This function provides an interface mirroring that of the GDAL
command-line app ogr2ogr
. For a description of the
utility and the arguments that it takes, see the documentation at
https://gdal.org/programs/ogr2ogr.html.
Usage
ogr2ogr(
src_datasource_name,
dst_datasource_name,
...,
layer,
f,
append,
overwrite,
update,
select,
progress,
sql,
dialect,
where,
skipfailures,
spat,
spat_srs,
geomfield,
dsco,
lco,
nln,
nlt,
dim,
a_srs,
t_srs,
s_srs,
ct,
preserve_fid,
fid,
limit,
oo,
doo,
gt,
ds_transaction,
clipsrc,
clipsrcsql,
clipsrclayer,
clipsrcwhere,
clipdst,
clipdstsql,
clipdstlayer,
clipdstwhere,
wrapdateline,
datelineoffset,
simplify,
segmentize,
makevalid,
fieldTypeToString,
unsetFieldWidth,
mapFieldType,
fieldmap,
splitlistfields,
maxsubfields,
resolveDomains,
explodecollections,
zfield,
gcp,
order,
tps,
s_coord_epoch,
t_coord_epoch,
a_coord_epoch,
addfields,
unsetFid,
emptyStrAsNull,
relaxedFieldNameMatch,
forceNullable,
unsetDefault,
nomd,
mo,
noNativeData,
config_options = character(0),
dryrun = FALSE
)
Arguments
src_datasource_name |
Character. Path to a GDAL-supported readable datasource. |
dst_datasource_name |
Character. Path to a GDAL-supported output file. |
... |
Here, a placeholder argument that forces users to supply exact names of all subsequent formal arguments. |
layer , f , append , overwrite , update , select , progress , sql , dialect |
See the GDAL project's ogr2ogr documentation for details. |
where , skipfailures , spat , spat_srs , geomfield , dsco , lco , nln , nlt |
|
dim , a_srs , t_srs , s_srs , ct , preserve_fid , fid , limit , oo , doo , gt |
See the See ogr2ogr documentation. |
ds_transaction , clipsrc , clipsrcsql , clipsrclayer , clipsrcwhere |
|
clipdst , clipdstsql , clipdstlayer , clipdstwhere , wrapdateline |
|
datelineoffset , simplify , segmentize , makevalid , addfields |
See See ogr2ogr documentation. |
fieldmap , splitlistfields , maxsubfields |
|
resolveDomains , explodecollections , zfield , gcp , order , tps |
|
s_coord_epoch , t_coord_epoch , a_coord_epoch |
|
unsetFid , emptyStrAsNull , relaxedFieldNameMatch , forceNullable |
See See ogr2ogr documentation. |
unsetDefault , fieldTypeToString , unsetFieldWidth , mapFieldType |
|
nomd , mo , noNativeData |
|
config_options |
A named character vector with GDAL config
options, of the form |
dryrun |
Logical (default |
Value
Silently returns path to dst_datasource_name
.
Author(s)
Joshua O'Brien
Examples
## Prepare file paths
td <- tempdir()
lux <- system.file("ex/lux.shp", package = "terra")
lux_merc <- file.path(td, "mercator.shp")
lux_lcc <- file.path(td, "lcc.shp")
## Reproject to 'WGS 84/World Mercator'
## https://en.wikipedia.org/wiki/Mercator_projection
ogr2ogr(lux, lux_merc, t_srs = "EPSG:3395", overwrite = TRUE)
## Reproject to a Canadian 'Lambert conformal conic projection'
## https://en.wikipedia.org/wiki/Lambert_conformal_conic_projection
ogr2ogr(lux, lux_lcc, t_srs = "EPSG:3347", overwrite = TRUE)
if(require(terra)) {
op <- par(mfcol = c(1,2))
plot(vect(lux_merc), main = "WGS 84",
border = "darkgrey", col = gray.colors(12))
plot(vect(lux_lcc), main = "LCC",
border = "darkgrey", col = gray.colors(12))
par(op)
}