Obtains the internal type-constant name for the data attributes in a source.
vapour_report_fields(dsource, layer = 0L, sql = "")
vapour_report_attributes(dsource, layer = 0L, sql = "")
data source name (path to file, connection string, URL)
integer of layer to work with, defaults to the first (0) or the name of the layer
if not empty this is executed against the data source (layer will be ignored)
named character vector of the GDAL types for each field
Use this to compare the interpreted versions converted into R types by
vapour_read_fields
.
This and vapour_read_fields()
are aliased to older versions named 'vapour_report_attributes()' and
'vapour_read_attributes()', but "field" is a clearer and more sensible name (in our opinion).
These are defined for the enum OGRFieldType in GDAL itself. https://gdal.org/doxygen/ogr__core_8h.html#a787194bea637faf12d61643124a7c9fc
file <- "list_locality_postcode_meander_valley.tab"
mvfile <- system.file(file.path("extdata/tab", file), package="vapour")
vapour_report_fields(mvfile)
#> LOCAL_ID NAME POSTCODE PLAN_REF GAZ_DATE NOM_REG_NO
#> "OFTReal" "OFTString" "OFTInteger" "OFTString" "OFTDate" "OFTString"
#> UFI CREATED_ON LIST_GUID SHAPE_AREA SHAPE_LEN
#> "OFTString" "OFTString" "OFTString" "OFTReal" "OFTReal"
## modified by sql argument
vapour_report_fields(mvfile,
sql = "SELECT POSTCODE, NAME FROM list_locality_postcode_meander_valley")
#> POSTCODE NAME
#> "OFTInteger" "OFTString"