GeoProcessor / Command / ReadGeoLayersFromFGDB
Overview
The ReadGeoLayersFromFGDB
command reads one or more GeoLayer(s)
from an Esri File Geodatabase.
Command Editor
The following dialog is used to edit the command and illustrates the command syntax.
ReadGeoLayersFromFGDB
Command Editor (see full-size image)
Command Syntax
The command syntax is as follows:
ReadGeoLayerFromFGDB(Parameter="Value",...)
Command Parameters
Parameter | Description | Default |
---|---|---|
InputFolder required |
The file geodatabase to read (must end in .gdb ). |
None - must be specified. |
ReadOnlyOneFeatureClass required |
Boolean If TRUE , only one feature class will be read as a GeoLayer. Must specify a valid feature class name. If FALSE , one or more feature classes will be read as GeoLayers. Can specify the Subset_Pattern to select which feature classes to read. |
|
IfGeoLayerIDExists |
The action that occurs if the GeoLayerID already exists within the GeoProcessor:
|
Replace |
IF ReadOnlyOneFeatureClass is TRUE ... |
||
Feature Class required |
The name of the feature class within the file geodatabase to read. ${Property} syntax is recognized. |
None - must be specified. |
GeoLayerID required |
A GeoLayer identifier. Formatting characters and ${Property} syntax are recognized. Refer to documentation for best practices on naming GeoLayer identifiers. |
None - must be specified. |
IF ReadOnlyOneFeatureClass is FALSE ... |
||
GeoLayerID_prefix |
A GeoLayer identifier prefix. GeoLayers read from a file geodatabase have an identifier in the GeoLayerID_prefix_FeatureClass format. |
No prefix is used. The GeoLayerID is the name of the feature class. |
Subset_Pattern |
The glob-style pattern (e.g., CO_* or *_[MC]O ) of feature classes to read from the file geodatabase. |
No pattern is used. All feature classes within the file geodatabase are read. |
Name |
Name of the output GeoLayer. | Feature class name. |
Description |
Description for the output GeoLayer. | |
Properties |
Additional properties to assign to the GeoLayer, using format: prop1:value1,prop2:'string with space' . Can use ${Property} notation. |
No additional properties are assigned. |
Examples
The following folder, ExampleFolder
, and its contents are used for the examples.
The ExampleFolder
is not an actual existing folder.
It is used in this documentation to explain how the ReadGeoLayersFromFGDB
command interacts with similar, existing folders on the computer.
ExampleFolder
Filename | File Type |
---|---|
ExampleFileGDB.gdb | Esri File Geodatabase |
ExampleFileGDB.gdb
Feature Class |
---|
ExampleFeatureClass1 |
ExampleFeatureClass2 |
ExampleFeatureClass3 |
Example 1: Read All Feature Classes from a File Geodatabase
See the automated tests.
ReadGeoLayersFromFGDB(InputFolder="ExampleFolder/ExampleFileGDB.gdb")
After running the command, the following GeoLayer IDs are registered within the GeoProcessor.
Registered GeoLayer IDs |
---|
ExampleFeatureClass1 |
ExampleFeatureClass2 |
ExampleFeatureClass3 |
Example 2: Add a Prefix to the GeoLayer IDs
ReadGeoLayersFromFGDB(InputFolder="ExampleFolder/ExampleFileGDB.gdb",GeoLayerID_Prefix="StateData")
After running the command, the following GeoLayer IDs are registered within the GeoProcessor. Each of the registered GeoLayer IDs include the StateData
prefix.
Registered GeoLayer IDs |
---|
StateData_ExampleFeatureClass1 |
StateData_ExampleFeatureClass2 |
StateData_ExampleFeatureClass3 |
Example 3: Read a Subset of Feature Classes From a File Geodatabase
ReadGeoLayersFromFGDB(InputFolder="ExampleFolder/ExampleFileGDB.gdb",Subset_Pattern="*3")
After running the command, the following GeoLayer IDs are registered within the GeoProcessor.
ExampleFeatureClass1
and ExampleFeatureClass2
are not included in the registered GeoLayer IDs
becasue the Subset_Pattern
parameter only includes feature classes that end in 3
.
Registered GeoLayer IDs |
---|
ExampleFeatureClass3 |
Troubleshooting
- Requires GDAL/OGR 1.11.0+
- Requires ESRI FileGDB driver to be installed within QGIS environment
- TODO egiles 2018-01-12 Link to QGIS install instructions that clarify how to install OGR_FileGDB library from this resource - this should be in the install/deploy instructions.
See Also
- The GeoLayers are read using the
QGIS QgsVectorLayer Class
. See documentation for examples on utilizing theQgsVectorLayer
class in the PyQGIS environment.