ogrinfo: ogrinfo

Description Usage Arguments Details Value Author(s) References Examples

View source: R/ogrinfo.R

Description

R wrapper for ogrinfo: lists information about an OGR supported data source

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
ogrinfo(
  datasource_name,
  layer,
  ro,
  q,
  where,
  spat,
  geomfield,
  fid,
  sql,
  dialect,
  al,
  so,
  fields,
  geom,
  oo,
  nomd,
  listmdd,
  mdd,
  nocount,
  noextent,
  formats,
  ignore.full_scan = TRUE,
  verbose = FALSE
)

Arguments

datasource_name

Character. The data source to open. May be a filename, directory or other virtual name. See the OGR Vector Formats list for supported datasources.

layer

Character. One or more layer names may be reported.

ro

Logical. Open the data source in read-only mode.

q

Logical. Quiet verbose reporting of various information, including coordinate system, layer schema, extents, and feature count.

where

Character. An attribute query in a restricted form of the queries used in the SQL WHERE statement. Only features matching the attribute query will be reported.

spat

Numeric. c(xmin,ymin,xmax,ymax) The area of interest. Only features within the rectangle will be reported.

geomfield

Character. (OGR >= 2.0) Name of the geometry field on which the spatial filter operates on.

fid

Numeric. If provided, only the feature with this feature id will be reported. Operates exclusive of the spatial or attribute queries. Note: if you want to select several features based on their feature id, you can also use the fact the 'fid' is a special field recognized by OGR SQL. So, '-where "fid in (1,3,5)"' would select features 1, 3 and 5.

sql

Character. Execute the indicated SQL statement and return the result.

dialect

Character. SQL dialect. In some cases can be used to use (unoptimized) OGR SQL instead of the native SQL of an RDBMS by passing OGRSQL. Starting with GDAL 1.10, the "SQLITE" dialect can also be used with any datasource.

al

Logical. List all features of all layers (used instead of having to give layer names as arguments).

so

Logical. Summary Only: supress listing of features, show only the summary information like projection, schema, feature count and extents.

fields

Character. ("YES"|"NO") (starting with GDAL 1.6.0) If set to NO, the feature dump will not display field values. Default value is YES.

geom

Character. ("YES"|"NO"|"SUMMARY") (starting with GDAL 1.6.0) If set to NO, the feature dump will not display the geometry. If set to SUMMARY, only a summary of the geometry will be displayed. If set to YES, the geometry will be reported in full OGC WKT format. Default value is YES.

oo

Character. "NAME=VALUE". (starting with GDAL 2.0) Dataset open option (format specific).

nomd

Logical. (starting with GDAL 2.0) Suppress metadata printing. Some datasets may contain a lot of metadata strings.

listmdd

Logical. (starting with GDAL 2.0) List all metadata domains available for the dataset.

mdd

Character. (starting with GDAL 2.0) Report metadata for the specified domain. "all" can be used to report metadata in all domains.

nocount

Logical. (starting with GDAL 2.0) Suppress feature count printing.

noextent

Logical. (starting with GDAL 2.0) Suppress spatial extent printing.

formats

Logical. List the format drivers that are enabled.

ignore.full_scan

Logical. If FALSE, perform a brute-force scan if other installs are not found. Default is TRUE.

verbose

Logical. Enable verbose execution? Default is FALSE.

Details

This is an R wrapper for the 'ogrinfo' function that is part of the Geospatial Data Abstraction Library (GDAL). It follows the parameter naming conventions of the original function, with some modifications to allow for more R-like parameters. For all parameters, the user can use a single character string following, precisely, the gdalinfo format (http://gdal.org/ogrinfo.html), or, in some cases, can use R vectors to achieve the same end.

This function assumes the user has a working GDAL on their system. If the "gdalUtils_gdalPath" option has been set (usually by gdal_setInstallation), the GDAL found in that path will be used. If nothing is found, gdal_setInstallation will be executed to attempt to find a working GDAL.

Value

character

Author(s)

Jonathan A. Greenberg (gdalUtils@estarcion.net) (wrapper) and Frank Warmerdam (GDAL lead developer).

References

http://www.gdal.org/ogrinfo.html

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
# We'll pre-check to make sure there is a valid GDAL install.
# Note this isn't strictly neccessary, as executing the function will
# force a search for a valid GDAL install.
gdal_setInstallation()
valid_install <- !is.null(getOption("gdalUtils_gdalPath"))
if(valid_install)
{
datasource_name <- system.file("external/tahoe_highrez_training.shp", package="gdalUtils")
# Display all available formats:
# Command-line ogrinfo call:
# ogrinfo --formats
ogrinfo(formats=TRUE)

# Get info on an entire shapefile:
# ogrinfo tahoe_highrez_training.shp
ogrinfo(datasource_name)

# Get info on the layer of the shapefile:
# ogrinfo tahoe_highrez_training.shp tahoe_highrez_training
ogrinfo(datasource_name,"tahoe_highrez_training")
}

gdalUtils documentation built on Feb. 14, 2020, 1:08 a.m.