Skip to contents

srs_is_same() returns TRUE if these two spatial references describe the same system. This is a wrapper for OSRIsSame() in the GDAL Spatial Reference System C API.

Usage

srs_is_same(
  srs1,
  srs2,
  criterion = "",
  ignore_axis_mapping = FALSE,
  ignore_coord_epoch = FALSE
)

Arguments

srs1

Character string. OGC WKT for a spatial reference system.

srs2

Character string. OGC WKT for a spatial reference system.

criterion

Character string. One of STRICT, EQUIVALENT, EQUIVALENT_EXCEPT_AXIS_ORDER_GEOGCRS. Defaults to EQUIVALENT_EXCEPT_AXIS_ORDER_GEOGCRS.

ignore_axis_mapping

Logical scalar. If TRUE, sets IGNORE_DATA_AXIS_TO_SRS_AXIS_MAPPING=YES in the call to OSRIsSameEx() in the GDAL Spatial Reference System API. Defaults to NO.

ignore_coord_epoch

Logical scalar. If TRUE, sets IGNORE_COORDINATE_EPOCH=YES in the call to OSRIsSameEx() in the GDAL Spatial Reference System API. Defaults to NO.

Value

Logical. TRUE if these two spatial references describe the same system, otherwise FALSE.

Examples

elev_file <- system.file("extdata/storml_elev.tif", package="gdalraster")
ds <- new(GDALRaster, elev_file, TRUE)
srs_is_same(ds$getProjectionRef(), epsg_to_wkt(26912))
#> [1] TRUE
srs_is_same(ds$getProjectionRef(), epsg_to_wkt(5070))
#> [1] FALSE
ds$close()