vapour_layer_info: Read GDAL layer info

View source: R/vapour_input_geometry.R

vapour_layer_infoR Documentation

Read GDAL layer info

Description

Read GDAL layer information for a vector data source.

Usage

vapour_layer_info(
  dsource,
  layer = 0L,
  sql = "",
  extent = NA,
  count = TRUE,
  ...
)

Arguments

dsource

data source name (path to file, connection string, URL)

layer

integer of layer to work with, defaults to the first (0) or the name of the layer

sql

if not empty this is executed against the data source (layer will be ignored)

extent

apply an arbitrary extent, only when 'sql' used (must be 'ex = c(xmin, xmax, ymin, ymax)' but sp bbox, sf bbox, and raster extent also accepted)

count

logical to control if count calculated and returned, TRUE by default (set to FALSE to avoid the extra calculation and missing value is the result)

...

unused, reserved for future use

Details

Set extent and/or count to FALSE to avoid calculating them if not needed, it might take some time.

The layer information elements are

dsn

the data source name

driver

the short name of the driver used

layer

the name of the layer queried

layer_names

the name/s of all available layers (see vapour_layer_names)

fields

a named vector of field types (see vapour_report_fields)

count

the number of features in this data source (can be turned off to avoid the extra work count)

extent

the extent of all features xmin, xmax, ymin, ymax (can be turned off to avoid the extra work extent)

projection

a list of character strings, see next

⁠$projection⁠ is a list of various formats of the projection metadata. Use ⁠$projection$Wkt⁠ as most authoritative, but we don't enter into the discussion or limit what might be done with this (that's up to you). Currently we see c("Proj4", "MICoordSys", "PrettyWkt", "Wkt", "EPSG", "XML") as names of this ⁠$projection⁠ element.

To get the geometry type/s of a layer see vapour_read_type().

Value

list with a list of character vectors of projection metadata, see details

See Also

vapour_geom_name vapour_layer_names vapour_report_fields vapour_read_fields vapour_driver vapour_read_names

Examples

file <- "list_locality_postcode_meander_valley.tab"
## A MapInfo TAB file with polygons
mvfile <- system.file(file.path("extdata/tab", file), package="vapour")
info <- vapour_layer_info(mvfile)
names(info$projection)

## info depends on the query/spatial-filter
vapour_layer_info(mvfile, extent = c(412000,  420000, 5352612.8, 5425154.3), 
  sql = "SELECT * FROM list_locality_postcode_meander_valley")$count

vapour documentation built on June 22, 2024, 10:01 a.m.