Feature Layer Connection Strings

A feature layer is a complex TerraExplorer object designed to display feature datasets from different sources.

A connection string standard is used to define connections to various layer source file formats and servers. The connection string specifies information about the data source and the means of connecting to it. The string is then passed to ICreator.CreateFeatureLayer to create the new layer.

SeeFeature Layers” chapter in the TerraExplorer User Manual for additional information.

 

The connection string contains a series of parameters separated by semicolons (;). The string consists of a series of keyword/value pairs separated by semicolons. The equal sign (=) connects each keyword and its value.

For example, this connection string loads the shapefile “C:\sample.shp” as a layer:

“FileName=C:sample.shp;TEPlugName=OGR;“

 

The following parameters are supported:

§   TEPlugName=OGR Used to load layers from the following data sources. An additional parameter is required as described below:

·          Shapefile:

“FileName=FullPathToShapeFile

Where FullPathToShapeFile defines a full path to the shapefile.

·          DGN file:

“FileName=FullPathToDGNFile

Where FullPathToDGNFile defines a full path to the DGN file.

·          DXF file:

“FileName=FullPathToShapeFile

Where FullPathToShapeFile defines a full path to the DXF file.

·          Oracle Spatial:

“OGRConnectionString= OCI:userid/password@database_instance:table,table”.

Where userid/password defines respectively the user name and password required for connecting to the server, database_instance defines the Oracle Net Service name, and table defines the table to access.

·          PostgreSQL extended with the PostGIS spatial data support:

LayerName=LayerName;OGRConnectionString={ PG:dbname=’databasename’}”

Where databasename defines the database name.
Additional parameters may be provided as required, e.g. { PG:dbname=’databasename’ host='addr' port='5432' user='userid' password='password'}.

·          MongoDB:

"LayerName=LayerName;OGRConnectionString=mongodb+srv://UserName:Password@Host/DatabaseName"

Where UserName:Password define respectively the user name and password for connecting to the service, Host defines the IP address of the database, and DatabaseName defines the database name.

·          MS SQL Spatial:

“OGRConnectionString={ MSSQL:server=servername;database=databasename;UID=userid;PWD=password;Tables=table}”

Where servername defines the server name, databasename defines the database to connect to, userid and password define the user name and password respectively, and table defines the table to access.

·          Esri:

"FileName=ServerURL;LayerName=ESRIJSON;SeverURLExtraParams=Token"
Where FileName defines a full URL to the layer, e.g. https://services.thelist.tas.gov.au/arcgis/rest/services/Public/CadastreAndAdministrative/MapServer/4 and LayerName is always set equal to ESRIJSON and ServerURLExtraParams sets additional parameters to send to the server e.g. token.

·          SQLite:

“FileName=FullPathToSQLiteFile;LayerName=LayerName

Where FullPathToSQLiteFile defines a full path to the SQLite file, LayerName defines the name of the layer to be loaded.

·          GeoDatabase:

“FileName=FullPathToGeoDatabaseFile;LayerName=LayerName

Where FullPathToGeoDatabaseFile defines a full path to the GeoDatabase file, LayerName defines the name of the layer to be loaded.

·          GeoPackage:

“FileName=FullPathToGeoPackageFile;LayerName=LayerName

Where FullPathToGeoPackageFile defines a full path to the GeoPackage file, LayerName defines the name of the layer to be loaded.

·          GeospatialPDF:

“FileName=FullPathToGeospatialPDFFile;LayerName=LayerName

Where FullPathToGeospatialPDF defines a full path to the Geospatial PDF file, LayerName defines the name of the layer to be loaded.

§   TEPlugName= WFS – Used to load layers from Web Feature Server (WFS). Additional parameters are required (mandatory fields are bolded):

·          Server:

“Server=ServerURL

Where ServerURL defines a full URL to the server.

·          WFSVersion:

“WFSVersion =Version

Supported Version values are “1.0.0” and “1.1.0”.

·          LayerName:

“LayerName=LayerName”

Where LayerName defines the name of the layer to be loaded.

·          User:

“User=UserName

Where UserName defines the user name required to connect to the server.

·          Password:

“Password=Password

Where Password defines the user name required to connect to the server.

·          Lat-Long or Long-Lat coordinate format:

“CRS_XY_OR_YX=Format

Supported Format values are “1” for Long-Lat and “2” for Lat-Long.

§   TEPlugName=GeoDatabase – Used to load layers from a Personal Geodatabase file. Additional parameters are required (mandatory fields are bolded):

·          LayerName:

“LayerName=ServerURL

Where LayerName defines a full path to the GeoDatabase file.

·          TableName:

“TableName =TableName

Where LayerName defines the name of the table containing the layer to be loaded.

§   TEPlugName= DSN – Used to load layers from an ODBC database connection. Additional parameters are required (mandatory fields are bolded):

·          DSNPlugName:

“DSNPlugName=PlugName

Where PlugName defines the ODBC driver. For example: “Microsoft Access(*.mdb)”.

·          DSNConnectionString:

“DSNConnectionString=ConnectionString

Where ConnectionString defines the DSN connection string as required by the defined driver.

·          DSN_X_Field:

“DSN_X_Field=X

Where X defines the database field name containing the X coordinate.

·          DSN_Y_Field:

“DSN_Y_Field=Y

Where Y defines the database field name containing the Y coordinate.

·          DSN_AltitudeField:

“DSN_AltitudeField=Altitude

Where Altitude defines the database field name containing the altitude value.

·          TableName:

“TableName=TableName

Where LayerName defines the name of the table containing the layer to be loaded.

 

An existing layer can be manipulated and controlled using the IFeatureLayer80 interface. This includes controlling appearance of the feature and annotation information, managing the streaming behavior, and adding and removing individual items.