Description Usage Arguments Details Value Author(s) References Examples
R wrapper for ogrtindex: creates a tileindex
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
output_dataset |
Character. Output tile index. |
src_dataset |
Character. Input geospatial files. |
lnum |
Numeric. n. Add layer number 'n' from each source file in the tile index. |
lname |
Character. name. Add the layer named 'name' from each source file in the tile index. |
f |
Character. output_format. Select an output format name. The default is to create a shapefile. |
tileindex |
Character. file_name. The name to use for the dataset name. Defaults to LOCATION. |
write_absolute_path |
Logical. Filenames are written with absolute paths. |
skip_different_projection |
Logical. Only layers with same projection ref as layers already inserted in the tileindex will be inserted. |
accept_different_schemas |
Logical. By default ogrtindex checks that all layers inserted into the index have the same attribute schemas. If you specify this option, this test will be disabled. Be aware that resulting index may be incompatible with MapServer! |
output_Vector |
Logical. Return output output_dataset as a Spatial* object. Currently only works with f="ESRI Shapefile". |
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. |
This is an R wrapper for the 'ogrtindex' 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/ogrtindex.html), or, in some cases, can use R vectors to achieve the same end.
The ogrtindex program can be used to create a tileindex - a file containing a list of the identities of a bunch of other files along with there spatial extents. This is primarily intended to be used with MapServer for tiled access to layers using the OGR connection type.
If no -lnum or -lname arguments are given it is assumed that all layers in source datasets should be added to the tile index as independent records.
If the tile index already exists it will be appended to, otherwise it will be created.
It is a flaw of the current ogrtindex program that no attempt is made to copy the coordinate system definition from the source datasets to the tile index (as is expected by MapServer when PROJECTION AUTO is in use).
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.
NULL or SpatialPolygonsDataFrame
Jonathan A. Greenberg (gdalUtils@estarcion.net) (wrapper) and Frank Warmerdam (GDAL lead developer).
http://www.gdal.org/ogrtindex.html
1 2 3 4 5 6 7 8 9 10 11 12 13 | # 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(require(rgdal) && valid_install)
{
tempindex <- tempfile(fileext=".shp")
src_dir <- system.file("external/", package="gdalUtils")
src_files <- list.files(src_dir,pattern=".shp",full.names=TRUE)
ogrtindex(output_dataset=tempindex,src_dataset=src_files,
accept_different_schemas=TRUE,output_Vector=TRUE)
}
|
sh: 1: cannot create /dev/null: Permission denied
Warning messages:
1: In gdal_setInstallation() :
No GDAL installation found. Please install 'gdal' before continuing:
- www.gdal.org (no HDF4 support!)
- www.trac.osgeo.org/osgeo4w/ (with HDF4 support RECOMMENDED)
- www.fwtools.maptools.org (with HDF4 support)
2: In gdal_setInstallation() : If you think GDAL is installed, please run:
gdal_setInstallation(ignore.full_scan=FALSE)
Loading required package: rgdal
Loading required package: sp
rgdal: version: 1.2-10, (SVN revision 673)
Geospatial Data Abstraction Library extensions to R successfully loaded
Loaded GDAL runtime: GDAL 1.10.1, released 2013/08/26
Path to GDAL shared files: /usr/share/gdal/1.10
Loaded PROJ.4 runtime: Rel. 4.8.0, 6 March 2012, [PJ_VERSION: 480]
Path to PROJ.4 shared files: (autodetected)
WARNING: no proj_defs.dat in PROJ.4 shared files
Linking to sp version: 1.2-3
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.