AddPGSQLLayerToWorkspace()
Summary
Add layer to current workspace after exporting it to PGSQL spatial database.
Syntax
AddPGSQLLayerToWorkspace(string layer_name, string file_name, string table_name, string schema_name, array opts)
| Argument |
Type |
Contents |
| layer_name |
string |
Name of layer being exported |
| file_name |
string |
Name of server + database |
| table_name |
string |
Name of table to which layer is being exported |
| schema_name |
string |
Name of schema to which layer is being exported |
| opts |
options array |
Options array |
| Option |
Type |
Contents |
| Fields |
array |
Layer fields |
| Indexed Fields |
array |
indexed layer fields |
| [ID Field] |
string |
Name of layer field used as id |
| [Layer Name] |
string |
Name of layer being exported |
| [Add To Map] |
integer |
1 if user wants layer added to map after export, 0 if not |
| Database |
string |
Name of database to which layer is being exported |
| Owner |
string |
Name of schema to which layer is being exported |
| SRID |
string |
Spatial reference identifier for layer geometry |
| Table |
string |
Name of table to which layer is being exported |
| LogFile |
string |
Path to log file |
| Type |
string |
Type of layer, e.g. "Line" |
| [Geometry Field] |
string |
Name of field containing geometric data |
Example
opts = {
Fields:["Field1","Field2"},
Indexed Fields:["Indexed Field1],
ID Field: "ID",
Layer Name: "My layer",
Add to Map: 1,
Database: "spatial_db1",
Owner: "public",
SRID: 4326,
Table: "table_1",
LogFile: "path\to\log.file",
Type: "Line",
Geometry Field: "Location"
}
Layer_name = AddPGSQLLayerTOWOrkspace("My Streets", "localhost|spatial_db1", "table_1", "public", opts)
Error Codes
| Error Type |
Meaning |
| Error |
Invalid service name, table name or schema name; or failed to log user in with provided credentials; or failed to extract option from options array; or failed to add external layer to map |
| Not Found |
Map view is not found based on provided map |
See Also