AddGdalVectorLayerToWorkspace()
Summary
Adds a Gdal Vector Layer to a workspace
Syntax
rslt = AddGdalVectorLayerToWorkspace( string layer_name, string file_name, array params) )
| Argument | Contents |
|---|---|
| layer_name | The layer to be added. It must match one of the layer names reported byGetGdalVectorInfo() |
| file_name | Full path, including the database extension |
| params | An options array as described below |
| Parameter | Type | Contents |
|---|---|---|
| Label | String | The internal layer label. |
| Layer Name | String | Required. The desired name for the layer in the map |
| Type | String | Required. The geographic layer type: Point, Line or Area |
| Read Only | String | "True" to open read only, "False" (default) otherwise |
| Shared | String | "True" to open shared, "False" (default) otherwise; "False" sets the Exclusive mode |
Returns
A string indicating the actual name of the layer, which is identical to layer_name unless the layer name is already in use.
Notes
-
The supported file types include JSON files with extensions as JSON and GeoJSON - a plain text format for vector layers, ArcGIS File Geodatabases with the extension .gdb
FlatGeobuf files with the extension .fgb
Example
file = "C:\\temp\\My Customers Layer.geojson"
layer_info = GetGdalVectorInfo(file)
layer_names = layer_info.[Point Layers] // Get all layers of a specified type available in the input file
layer_name = layer_names[1] // Choose one of the layers in the input file
p.Label = "Points"
p.[Layer Name] = layer_name
p.[Type] = "Point"
p.[Read Only] = "false"
p.[Add To Map] = "True"
rslt = AddGdalVectorLayerToWorkspace( "Customers", file, p)
Error Codes
| Error Type | Meaning |
|---|---|
| Error | The input file does not exist or is invalid. |
See Also
| Function | Summary |
|---|---|
| GetGdalVectorInfo() | Returns an array of info elements for a Gdal Vector Data file. |
| AddGdalVectorLayer() | Adds a Gdal Vector Layer to a map |
|
©2026 Caliper Corporation |