Cadcorp SIS API Methods

CreateDataSourceOverlay Method

Description

Inserts a dataset into the current SIS Workspace Definition (SWD), which will fetch data from non-file data source.

See OGC WMS for a full description.

Syntax

Visual Basic
Public Function CreateDataSourceOverlay( _
   ByVal pos As Integer, _
   ByVal clsDataSource As String, _
   ByVal parameters As String _
) As Integer

Parameters

pos
The position in the overlays list at which to insert the overlay. If this argument specifies a position in the existing overlays, the new overlay will not replace the existing overlay at the given position, but will shuffle any other overlays down the list.
 
clsDataSource
The classname of the data source to use.
 
parameters
Comma-separated optional parameters to configure the data source.

Remarks

Notes:

Mandatory parameters will be coloured RED.

Examples using params = {} are based on Python.


Oracle Spatial

clsDataSource = "AOracleSpatialCursorDts"

Parameter Type Comments
service String  
user String  
password String  
table String  
geometrycolumn String  
Plaintext Boolean Set to "True" if passing a non-encrypted password when the server is expecting encryption.
An encrypted password is assumed by default, in this case do not specify the Plaintext parameter.
filter String  
cache Boolean  
anglecolumn String  
fcodecolumn String  
uricolumn String  

Example

In VB:

Dim params As String
Params = "user=MYLOGIN,password=MYPWD,service=MYDBSVR,table=MYTABLE,cache=true"
GisCreateDataSourceOverlay (1,"AOracleSpatialCursorDts ",params)

PostGIS

clsDataSource = "APostGisCursorDts"

Parameter Type Comments
host String  
port String  
database String  
user String  
password String  
table String  
geometrycolumn String  
Plaintext Boolean Set to "True" if passing a non-encrypted password when the server is expecting encryption.
An encrypted password is assumed by default, in this case do not specify the Plaintext parameter.
filter String  
cache Boolean  
anglecolumn String  
fcodecolumn String  
uricolumn String  

PostGIS Raster

clsDataSource = "PostGISRasterDataset"

Parameter Type Comments
host String  
port String  
database String  
user String  
password String  
schema String Typically "public"
rastertable String Equivalent to "table" in PostGIS
rastercolumn String Equivalent to "geometrycolumn" in PostGIS
Plaintext Boolean Set to "True" if passing a non-encrypted password when the server is expecting encryption.
An encrypted password is assumed by default, in this case do not specify the Plaintext parameter.
connectiontype String "dynamic"
"import"
"local"
showerrors Boolean  

Tile Map Service

clsDataSource = "TileMapServiceDataset"

params = {}
params['url'] = 'http://server:port/osgeoservice/tms/1.0.0/image-format/projection/name_of_layer_being_served.xml'

sis.CreateDataSourceOverlay(0, 'TileMapServiceDataset', json.dumps(params))


Open Street Map

clsDataSource = "OpenStreetMapDatasetEx"

Parameter Type Comments
Nodes Boolean  
Relations Boolean  
Ways Boolean  
SkipTags Boolean  

Note: It is not mandatory to include all of the above parameters, but at least one must be used

If adding parameters in old style parameter string, also use:

Parameter Type Comments
bbox String "minx,miny,maxx,maxy"

If adding parameters in (recommended) JSON string style, also use:

Parameter Type Comments
Left Double Equivalent minx
Bottom Double Equivalent miny
Right Double Equivalent maxx
Top Double Equivalent maxy

Example

String format:

sis.CreateDataSourceOverlay(0, "OpenStreetMapDatasetEx", "bbox=\" 11.54,48.14,11.543,48.145 \",Nodes=True")

JSON format:

p = { "Left":11.54,"Bottom":48.14,"Right":11.543,"Top":48.145,"Nodes": True, "Ways" :True, "Relations": True }
sis.CreateDataSourceOverlay(0, "OpenStreetMapDatasetEx", json.dumps(p))

Open Street Map Tile

clsDataSource = "OpenStreetMapTileDataset"

Parameter Type Comments
URL String URL to the Tile Server
MaxLevel Integer Max. zoom level

Example

params = {}
params["URL"] = "http://tile.openstreetmap.org/<z>/<x>/<revy>.png"
params["MaxLevel"] = 17
sis.CreateDataSourceOverlay(0,"OpenStreetMapTileDataset",  json.dumps(params))

Ordnance Survey DNF MasterMap

clsDataSource = "AOsDnfCursorDts"

Parameter Type Comments
Connection String Connection needs to be prefixed with ODB or MDB depending on source. See example below.
Table String Table is always "MASTERMAP"
points String "true" includes point geometry types.
"false" doesn't include point geometry types.
lines String "true" includes linestrings geometry types.
"false" doesn't include linestrings geometry types.
areas String "true" includes polygon geometry types.
"false" doesn't include polygon geometry types.

Example

Sis.CreateDataSourceOverlay(0,"AOsDnfCursorDts", "Connection=""ODB:c:\\Brighton.odb"", Table=""MASTERMAP"", points=""true"", lines=""true"", areas=""true""")

Notes: In VB.net use double dashes in path names and double quotes for embedded parameter string values.


ESRI File Geodatabase

clsDataSource = "FileGeoDatabaseDataset"

Parameter Type Comments
folder String Path to GeoDatabase File
table String Optional choice of table

GeoJSON

clsDataSource = "GeoJSONFeaturesDatasetEx"

params = {}
params["cache"] = True
params["url"] = "https://url_to_some/geojson_data/geo_data_file.geojson"
sis.CreateDataSourceOverlay(0, "GeoJSONFeaturesDatasetEx", json.dumps(params))


GeoRSS

clsDataSource = "GeoRSSDataset"

Parameter Type Comments
url String URL of GeoRSS to open
RefreshInterval Integer Number of minutes

TopoJSON

clsDataSource = "TopoJSONFeaturesDatasetEx"

params = {}
params["cache"] = True
params["url"] = "https://url_to_some/topo_json_data/topo_data_file.json"
sis.CreateDataSourceOverlay(0, "TopoJSONFeaturesDatasetEx", json.dumps(params))


ECW

clsDataSource = "ECWDataSource"

Parameter Type Comments
url String the ECWP URL

ArcIMS

clsDataSource = "ArcIMSDataSource"

Parameter Type Comments
url String the ArcIMS URL
service String the ArcIMS service

EXIF

clsDataSource = "EXIFDataset"

Parameter Type Comments
folder String path to folder
recurse String "true"

"false"


GDAL DataSource

clsDataSource = "GDALDataSource"
clsDataSource = "*_GDALDataset"

Parameter Type Comments
filename String path to file
model String Colour Model of raster:

"monochrome"

"grayscale"

"palette"

"rgb"

"hls"

"cmy"

"cmyk"

"grid"

"rgba"

stretch String Enable stretch:

"true"

"false"

method String Stretch method:

"linear"

"squareroot"

"logarithmic"

"exponential"

"equalization"

"negative"

trim Integer Stretch Tail Trim (%):

Number in the range 1 to 5, inclusive

band1 Integer Number where n can range from 0 to the number of bands -1, inclusive
band2 Integer
band3 Integer
band4 Integer
   

Notes on band selection:

Band selection always starts with `band1`, which then may be followed by `band2`, which in turn may be followed by `band3`, which in turn may be followed by `band4`.

There must be no 'gaps' in the band parameters.

For example, the following are valid band selection parameters:

band1=
band1=,band2=
band1=,band2=,band3=
band1=,band2=,band3=,band4=

Whereas, the following are invalid sequences:

band2=
band2=,band1=
band3=,band2=
band1=,band3=,band2=

The band indices are not relevant in the above examples and have therefore not been shown.

colour String red:green:blue e.g. 255:0:0 for red
algorithm String

Set the resampling method:

"none"

"nearestneighbour"

"bilinear"

"cubic"

"cubicspline"

"lanczos"


GeoDatabase

clsDataSource = "GeoDatabaseDataset"
tables


GML

clsDataSource = "AGMLImporterEx"

Parameter Type Comments
url String path to GML file
DefaultItemStatus Integer 0 invisible

1 visible

2 hittable

Validate Boolean  
PreloadSchema Integer Where n is the schema reference:

20102 is GML 2.1.2

30101 is GML 3.1.1

30201 is GML 3.2.1

-1 is Custom Schema (see below parameter)

SwapAxes Boolean By default, coordinates are expressed using the axis order defined in the CRS

True = force to always swap axes

False = force to never swap axes

CustomSchema String The path to the XML grammar file to be used.

Note: PreloadSchema parameter must be -1

Examples

For C#, either of the two forms:

sis.CreateDataSourceOverlay(0, "AGMLImporterEx", "url=\"file://localhost/D:\\\\data\\\\test.gml\",DefaultItemstatus=2,validate=true,PreloadSchema=30101");
sis.CreateDataSourceOverlay(0, "AGMLImporterEx", @"url=""file://localhost/D:\\data\\test.gml"",DefaultItemstatus=2,validate=true,PreloadSchema=30101");

For VB:

sis.CreateDataSourceOverlay(0, "AGMLImporterEx","url=""file://localhost/D:\\data\\test.gml"",DefaultItemstatus=2,validate=true,PreloadSchema=30101")

For Python, either of the two forms:

sis.CreateDataSourceOverlay(0, "AGMLImporterEx","url=\"file://localhost/D:\\\\data\\\\test.gml\",DefaultItemstatus=2,validate=true,PreloadSchema=30101")

 

sis.CreateDataSourceOverlay(0, "AGMLImporterEx","url=\"file://localhost/D:/data/test.gml\",DefaultItemstatus=2,validate=true,PreloadSchema=30101")

or serialising parameters from dictionary object to JSON string, then no extra escaping of backslashes \\\\ or double quotes \" is required:

params = {
"DefaultItemstatus":2,
"validate":1
"PreloadSchema":30101,
"url":"file://localhost/D:\\data\\test.gml"
}
sis.CreateDataSourceOverlay(0, "AGMLImporterEx", json.dumps(params))

Note: For API methods that take a list of string as a single parameter, Cadcorp recommend passing the list as a JSON string.


NGA Digital Nautical Chart

clsDataSource = "DNCDataSource"
clsDataSource = "DNCDataSourceEx"

Parameter Type Comments
directory String Path to folder containing NGA Digital Nautical Chart LHT file.
coverage String Name of coverage to add (as defined in the folder name)
lon Integer Centre longitude (degrees)
lat Integer Centre latitude (degrees)
width Integer Extents (degrees), Width (E/W)
height Integer Extents (degrees), Height (N/S)


The clsDataSource, "DNCDataSource", allows you to add an individual coverage. To load multiple coverages at once, use clsDataSource = "DNCDataSourceEx". It requires the same parameters as above as well as:

Parameter Type Comments
coverages String This is used instead of "coverage" listed above

 

The clsDataSource, "ADcwDts", uses slightly different parameter names, as follows:

Parameter Type Comments
folder String Path to folder containing LHT file
coverage String Name of coverage to add (as defined in the folder name)
longitude Integer Centre longitude (degrees)
latitude Integer Centre latitude (degrees)
radius Integer Extents (degrees) as a radius

Oracle Geo Raster

clsDataSource = "OracleGeoRasterDataset"

Parameter Type Comments
service String  
user String  
password String  
connectiontype String "dynamic"

"import"

"local"

georastertable String  
georastercolumn String  
rasterid String  
rdttable String The Raster Data Table
Plaintext Boolean Set to "True" if passing a non-encrypted password when the server is expecting encryption.
An encrypted password is assumed by default, in this case do not specify the Plaintext parameter.
forcegrid Boolean This is optional dependent on type of data.

To add an Oracle GeoRaster overlay in dynamic mode, you must add the forcegrid:False parameter.

showerrors Boolean  

Example:

VB.net:

Dim connection As String
connection = "OCI:User=qa;Password=spatial;Service=\""//10.0.0.22:1521/orcl.cadcorp.net\"""
Dim params As String
params = "{"
params += """connection"":""" + connection + """"
params += ","
params += """connectiontype"":""import"""
params += ","
params += """georastertable"":""SIS_GEORASTER_EXPORT"""
params += ","
params += """georastercolumn"":""GEORASTER"""
params += ","
params += """showerrors"":true"
params += ","
params += """rdttable"":""SIS_RDT"""
params += ","
params += """rasterid"":""12"""
params += ","
params += """owner"":""qa"""
params += "}"
sis.CreateDataSourceOverlay(0, "OracleGeoRasterDataset", params)

Oracle Network

clsDataSource = "OracleNetworkDataSource"

Parameter Type Comments
service String  
user String  
password String  
Plaintext Boolean Set to "True" if passing a non-encrypted password when the server is expecting encryption.
An encrypted password is assumed by default, in this case do not specify the Plaintext parameter.
showerrors Boolean  
network String  

Example:

Sis.CreateDataSourceOverlay(0, "OracleNetworkDataSource", "connection=""OCI:service=orac10g2;user=spatial;password=spatial"",showerrors=true,network=TEST11"

Ordnance Survey Address

clsDataSource = "OsDnfAddressDataset"
clsDataSource = "OsDnfITNDataset"

Parameter Type Comments
folder String Path to folder containing the dataset
recurse String "true"

"false"


Ordnance Survey Imagery

clsDataSource = "OsDnfImageryDataset"
clsDataSource = "OsDnfIndexDataset"

Parameter Type Comments
folder String Path to folder containing the dataset
recurse String "true"

"false"

label String "true"

"false"

gatewaylimit Integer  

OS (GB) Meridian 2

clsDataSource = "OSMeridian2Dataset"

Parameter Type Comments
folder String Path to folder containing the dataset

OGC CityGML Document

clsDataSource = "ACityGMLImporterEx"


OGC OWS Context Document

clsDataSource = "AOgcOwsContextDatasetEx"

Parameter Type Comments
url String  
showerrors Boolean  
cascadetowmc Boolean Controls whether to check WMSContext instead of an OWSContext document

OGC WMS Context Document

clsDataSource = "AOgcWmsContextDatasetEx"

Parameter Type Comments
url String  
showerrors Boolean  

OGC KML

clsDataSource = "KMLDatasetEx"

Parameter Type Comments
url String URL to KML data

Raster Index Dataset

clsDataSource = "RasterIndexDataset"

Parameter Type Comments
directory String path to folder containing rasters
scale Integer  
gatewaylimit Integer  
recurse Boolean  

SDE

clsDataSource = "SDEDataSource"

Parameter Type Comments
connection String "username/password@service"
extents String "lox, loy, hix, hiy"
layerid    
dynamic String "true"

"false"


SQL Server

The parameter string for a SQL Server connection must be a valid JSON string which contains following parameter:

connection: A connection string which contains the provider (SQLOLEDB.1), data source (server), catalog, password, and user id.

The following “connection” string is valid for a Microsoft SQL Server Connection which is represented in the Add Database Overlay dialog.

"connection":
"Provider=SQLOLEDB.1;
Password=spatial;
Persist Security Info=True;
User ID=username;
Initial Catalog=spatial;
Data Source=servername;"



datasource: The Table/Datasource (_dataSource$).

geometrycolumn: The geometry field from the SQL Server table (_geometryColumn$).

wkt: A well known text which describes the CRS coordinate reference system of the new data source overlay.

The following “wkt” string is valid for a new data source overlay which uses the British National Grid (OGC.OSGB_1936) as CRS. Other CRS WKT need to be built as JSON from the OGC Well-known Text in the Cadcorp SIS Named Object Library.

"wkt":
"PROJCS[\"OSGB 1936.British National Grid\",
GEOGCS[\"Latitude/Longitude.OGC.OSGB_1936\",
DATUM[\"OSGB_1936\",
SPHEROID[\"Airy 1830\",6377563.396,299.32496460007]],
PRIMEM[\"Greenwich\",0],
UNIT[\"degrees\",0.0174532925199433]],
PROJECTION[\"Transverse_Mercator\"],
PARAMETER[\"Central_Meridian\",-2],
PARAMETER[\"False_Easting\",400000],
PARAMETER[\"False_Northing\",-100000],
PARAMETER[\"Latitude_of_Origin\",49],
PARAMETER[\"Scale_Factor\",0.9996012717],
UNIT[\"m\",1]]"

cache: boolean

readonly: boolean


Below is a complete example of a JSON parameter string for a SQL Server (ASQLServerCursorDts) datasource connection:

{
"connection":
"Provider=SQLOLEDB.1;
Password=spatial;
Persist Security Info=True;
User ID=username;
Initial Catalog=initialcat;
Data Source=datasource;",
"datasource": "LOCKTABLE1",
"geometrycolumn": "GEOMETRY",
"wkt":
"PROJCS[\"OSGB 1936.British National Grid\",
GEOGCS[\"Latitude/Longitude.OGC.OSGB_1936\",
DATUM[\"OSGB_1936\",
SPHEROID[\"Airy 1830\",6377563.396,299.32496460007]],
PRIMEM[\"Greenwich\",0],
UNIT[\"degrees\",0.0174532925199433]],
PROJECTION[\"Transverse_Mercator\"],
PARAMETER[\"Central_Meridian\",-2],
PARAMETER[\"False_Easting\",400000],
PARAMETER[\"False_Northing\",-100000],
PARAMETER[\"Latitude_of_Origin\",49],
PARAMETER[\"Scale_Factor\",0.9996012717],
UNIT[\"m\",1]]",
"cache": true,
"filter":"FEATURE_ID<10"
"readonly": true
}

Note: "cache" and "filter" are described in the Microsoft SQL Server Spatial (Dataset) topic.

It is strongly recommended to validate the JSON string (for example with JSONLint).

If a SQL Server connection has been built in the SIS desktop then all parameters can be gathered from the dataset properties.


Vector Product Format

clsDataSource = "VpfDts"
clsDataSource = "VpfDtsEx"

Parameter Type Comments
directory String Path to the folder containing LHT file
coverage String Name of coverage to add (as defined in the folder name)
lat Integer Centre latitude (degrees)
lon Integer Centre longitude (degrees)
width Integer Extents (degrees), Width (E/W)
height Integer Extents (degrees), Height (N/S)


The clsDataSource, "VpfDts", allows you to add an individual coverage. To load multiple coverages at once, use clsDataSource = "VpfDtsEx". It requires the same parameters as above as well as:

Parameter Type Comments
coverages String This is used instead of "coverage" listed above

NASA World Wind

clsDataSource = "WorldWindDataset"

Parameter Type Comments
name String Name of layer to add.
names String Used to add multiple layers at once. Use instead of "name"
LayerSplit String

Define how multiple layers will split. Not required when adding single layer:

"none"

"layers"

"overlays"



WCS

clsDataSource = "WCSDataSource"

Parameter Type Comments
url String  
coverage String  
showerrors String "true"

"false"

user String  
password String  
connection String "dynamic"

"import"

"local"

forcegrid String "true"

"false"

temporal String "true"

"false"

defaultItemStatus Integer 0 invisible

1 visible

2 hittable


OGC Web Feature Service

clsDataSource = "WFSDataSource"

Parameter Type Comments
getfeaturesuri String  
describefeaturesuri String  
describefeaturetypepostdata String  
postdata String  
overlayname String  
requestmethod String "post"

"get"

validate Boolean  
showerrors Boolean  
username String  
password String  
defaultItemStatus Integer 0 invisible

1 visible

2 hittable

See OGC WFS topic for a full description.

Example:

Dim params,strURL As String
strURL = "http://www.cadcorpdev.co.uk/wfs/SisISAPI.dll?request=GETFEATURE&;version=1.0.0&;server=WFS&;typename=EDINBURGH---6&;propertyname=EDINBURGH---6.GML_Geometry,EDINBURGH---6.Status"
params = "Getfeaturesuri=""" &; strURL &; """,validate=true"
GisCreateDataSourceOverlay (0, " WFSDataSource", params)

OGC Web Mapping Service

clsDataSource = "AOgcWmsDataset"
Parameter Type Comments
url String  
showerrors Boolean  
multi String "true"

"false"

defaultItemStatus Integer 0 invisible

1 visible

2 hittable

dynamic Boolean  
tiles String  
user String  
password String  
context String  

Example

Dim params,strURL As String
strURL="http://www.datasource.co.uk/wms/SisISAPI.dll?VERSION=1.1.0&;SERVICE=WMS&;REQUEST=GetMap&;STYLES=&;FORMAT=image/png&;SRS=EPSG:27700&;LAYERS=EDINBURGH&;BBOX=300000,650000,350000,700000&;WIDTH=1&;HEIGHT=1&;BGCOLOR=0xFFFFFF&;TRANSPARENT=TRUE&;EXCEPTIONS=application/vnd.ogc.se_xml"
params = "URL=""" &; strURL &; """,dynamic=true"
sis.CreateDataSourceOverlay (0, "AOgcWmsDataset", params)

OGC Web Map Tile Service

clsDataSource = "WMTSDataset"

Parameter Type Comments
URL String  
RequestType Integer 0 GET

1 REST

LayerId String  
ImageFormat String  
TileMatrixSetId String  
ShowError Boolean  

The parameters should be passed as a JSON string. 


Available: GEO MD MM ME OD OM OV SISpy

Group:


Bing Maps, MapQuest, OS OpenSpace, Stamen

Data source classes shown in this section are available in all SIS products with UI:

ActiveX Control

Desktop SIS (MD, MM, ME), also via:

.NET GisLink API

Python in SIS:

Python GisLink API
Python API available in the Developer Control Bar

Data sources

  1. BingMapsAerialTileDataset
  2. BingMapsAerialWithLabelsTileDataset
  3. BingMapsRoadTileDataset
  4. MapQuestOSMTileDataset
  5. MapQuestOpenAerialTileDataset
  6. OSOpenSpaceProTileDataset
  7. StamenTonerLiteTileDataset
  8. StamenTonerTileDataset
  9. StamenWatercolorTileDataset

These datasets do not require any parameters.

Bing Maps

Add overlay and SIS will prompt for the Bing Maps Application Key (see the screen shot below).

1: sis.CreateDataSourceOverlay(0, 'BingMapsAerialTileDataset', '')

2: sis.CreateDataSourceOverlay(0, 'BingMapsAerialWithLabelsTileDataset', '')

3: sis.CreateDataSourceOverlay(0, 'BingMapsRoadTileDataset', '')

Bing Maps prompts for an Application Key

Bing Maps - alternative method

To avoid seeing the Application Key prompt, set the system variable _BingMapsApplicationKey$ prior to the API call (see the screen shot below).

1: sis.SetProperty(sis.SIS_OT_SYSTEM, 0, '_BingMapsApplicationKey$', 'AoJ0BHy...m')

2: sis.CreateDataSourceOverlay(0, 'BingMapsAerialTileDataset', '')

Note: The Application Key number shown in Line 1 above is for example only you must use your own Application Key number.

Bing Maps does not request an Application Key

MapQuest

Add overlay and SIS will prompt for the Application Key

1. sis.CreateDataSourceOverlay(0, 'MapQuestOSMTileDataset', '')

2. sis.CreateDataSourceOverlay(0, 'MapQuestOpenAerialTileDataset', '')

Alternatively, set the system variable _MapQuestApplicationKey$, similar to the Bing Maps alternative method shown above.

OS OpenSpace

Add overlay and SIS will prompt for the Application Key (see the screen shot below).

1. sis.CreateDataSourceOverlay(0, 'OSOpenSpaceProTileDataset', '')

Alternatively, set the system variable _OSOpenSpaceProApplicationKey$, similar to the Bing Maps alternative method shown above.

OS OpenSpace prompts for an Application Key

Stamen

Add overlay and SIS will display the dataset (see the screen shot below).

1. sis.CreateDataSourceOverlay(0, 'StamenTonerLiteTileDataset', '')

2. sis.CreateDataSourceOverlay(0, 'StamenTonerTileDataset', '')

3. sis.CreateDataSourceOverlay(0, 'StamenWatercolorTileDataset', '')

No Application Key is required, so no system variables are provided.

Stamen does not require an Application Key


Available: GEO MD MM ME OD OM OV SISpy

Group:


Send comments on this topic.

Click to return to www.cadcorp.com

© Copyright 2000-2017 Computer Aided Development Corporation Limited (Cadcorp).