GME

Geospatial Modelling Environment

list.vector (List Vector Datasets)

Creates a list of vector datasets in folders and subfolders matching user-specified search criteria

Description

The command searches a folder (and optionally all subfolders and geodatabases) for vector datasets, storing the results in a variable in GME (a list of strings containing the full path to each vector dataset, with a default name of "vectorlist"). If a 'match' string is specified, only vector datasets with names matching this search string are returned (e.g. if match="b*" only vector datasets beginning with the letter b are returned). The search can also be restricted to specific geometry types (point, line or polygon) using the type parameter (by default, vector datasets of any geometry type are returned).

When using the list of datasets in scripting and automation it is often useful to have a corresponding list that contains only the name of the vector dataset. If a value is specified for the namevariable parameter, a second variable in GME is created that contains only the dataset name (with no extension). For instance, if the first dataset in the returned list is "C:\data\soil.shp", the corresponding value in the namevariable list is "soil". This means that the vector dataset name can be easily retrieved and used in naming output files in a script.

The command will print the resulting list to the output window. For very large lists this may be unwanted, and it can be switched off by setting print=FALSE.

Syntax

list.vector(in, [match], [type], [subfolders], [variable], [namevariable], [print]);

inthe folder to search
[match]only include datasets that match this text (wildcards allowed)
[type]only list datasets of this geometry type (options: ANY, POLYGON, POLYLINE, POINT)
[subfolders](TRUE/FALSE) If TRUE, also searches all subfolders (default=FALSE)
[variable]the full path of returned raster datasets are stored in a variable of this name (default=vectorlist)
[namevariable]if specified, an additional variable containing only the names of the raster datasets (without file extensions) is created
[print](TRUE/FALSE) If TRUE, the list of datasets is printed to the output window (default=TRUE)

Example

list.vector(in="C:\data");

list.vector(in="C:\data", match="*.shp",, type="POINT", subfolder=TRUE, variable="shapefiles");

list.vector(in="C:\data", match="samp*", subfolder=TRUE, namevariable="names", print=FALSE);


Messages

Please consider making a purchase to support the continued development of these tools  Read more...

Tips on how to use this interface efficiently  Read more...

Links

Open Source GIS

Copyright © 2001-2014 Hawthorne L. Beyer, Ph.D., Spatial Ecology LLC    Connect on LinkedIn