Web Map Server: COM / Plugin reference
The Demis WMS engine consists of several COM objects, which are accessed by the IIS web server through simple ASP scripts.
We recommend that you build your web applications based on the OpenGIS specifications and retrieve information about a map through the capabilities XML. In most cases this will allow you to avoid depending on the Demis specific COM interfaces described in this section.
There are some exceptions, like where maps need to be loaded dynamically instead of from the Windows control panel, or where you develop a “Plugin” to draw your own graphics on top of the map.
The WMS.ASP script
ASP is not the only scripting language you can use, but the minimal ASP script you need is already provided by the software installation. This will interface the COM objects to IIS properly so binary images and other outputs can be passed on to the HTTP stream using a single script, WMS.ASP.
The contents of WMS.ASP are listed here for reference:
<%@ Language=VBScript %>
<%
dim MapServer, wms, content, contenttype
' connect to the WMS service, which was declared in global.asa
wms = Request.QueryString("wms")
if wms <> "" then set MapServer = WMSService.WMS(wms)
if not MapServer is nothing then
' process request
MapServer.WMSRequest Request.Querystring, content, contenttype
' return output
Response.ContentType = contenttype
if lcase(left(contenttype,5)) = "image" then
Response.BinaryWrite content
else
Response.Write content
end if
set MapServer = nothing
else
' wms not found error
if wms = "" then
Response.write("WMS Parameter is missing")
else
Response.Write(wms & " Service not found")
end if
end if
%>
What the script basically does is parse the WMS parameter from the url to determine which map you are addressing, then it connects to this map and passes on the request. Then finally, it will return the binary or text format output.
If you prefer to work with another scripting language like PHP, HTML/Javascript or even Flash, the included ASP script listed above is the only ASP you need and you can just leave it there “as-is”. You can combine this with another scripting language.
If you do for some specific reason need to address the COM objects directly from your own ASP scripts, we provide a summary of the objects involved here, DemisWMSConnect.Service and DemisWMSMap.Server.
If you need more information or have a specific problem, you can contact us for support at contact@demis.nl.
DemisWMSConnect.Service
This object represents the collection of maps you have setup using the WMS configuration in Windows control panel.
| Property | Type | Purpose |
|---|---|---|
WMS(name) | object | Returns the DemisWMSMap.Server instance for the map with the given name |
Count | long | Returns the number of maps currently loaded |
List(index) | string | Returns a listing of names for all loaded maps |
| Method | Purpose |
|---|---|
Add(name, mapfile) | Dynamically loads a map from mapfile, to be accessed using the given name |
Remove(name) | Removes the map with given name (use with caution!) |
DemisWMSMap.Server
This object represents a single map, and does the actual processing of all WMS requests.
| Method | Purpose |
|---|---|
WMSRequest(Request, Content, ContentType, [Extension]) | Process WMS request (see the listing of wms.asp above) |
LoadMap(mapfile) | Dynamically reloads the map from the given .map file |
| Function | Type | Purpose |
|---|---|---|
CreateExtension(ProgID) | object | Creates an instance of the plugin object with the given ProgID (explained in the next section) |
SetThematicData(…) | boolean | Set a thematic dataset for a vector layer, see the description below |
| Property | Type | Purpose |
|---|---|---|
WMS | string | Returns the WMS name for this map (i.e. “SAMPLE” or “WorldMap”) |
Title | string | Returns the Title for this map (i.e. “Demis World Map”) as set in the control panel |
SRS | string | Returns the Spatial Reference System for the map (default = “EPSG:4362”) |
MaxHeight | long | Set a maximum height in pixels for output images (default = 2000) |
MaxWidth | long | Set a maximum width in pixels for output images (default = 2000) |
CopyrightMessage | string | Set a copyright message to be displayed in the map (default = none) |
CopyrightPosition | string | Set the position for the copyright message (UL, UC, UR, LL, LC, LR) |
AbstractContactEmailContactOrganizationContactPersonKeywordListLatLonXminLatLonXmaxLatLonYminLatLonYmax
|
string |
Optional information fields, when provided these will be reflected in the Capabilities XML. Normally you can set all these properties using the WMS control panel dialogs so there usually is no need to access them programmatically. |
URLMain | string | Main URL of the Web server (i.e. http://hostname) |
URLDTDResource | string | URL where the DTD files referenced in the capabilities XML can be found (i.e. http://hostname/wms) |
URLRequest | string | URL of the WMS request script (i.e. http://hostname/wms/wms.asp?WMS=WorldMap&) |
HTMLBodyTag | string | Set a custom HTML BODY tag for feature info request output (default = <BODY>) |
HTMLHeader | string | Set a custom HTML HEAD tag for feature info request output (default = <HEAD><TITLE> Query results </TITLE></HEAD>) |
HTMLTableTag | string | Set a custom HTML TABLE tag for feature info request output (default = <TABLE border=1 width=100%>) |
HTMLQueryHeader | string | Set a custom HTML table header for feature info request output (default = <TR><TH width=25%> Layer </TH><TH width=15%> ID </TH><TH width=25%> Description </TH></TR>) |
HTMLFooter | string | Set custom HTML footer tags for feature info request output (default = none). Note: this will be added in between the </TABLE> and </BODY> tags. |
| Interface | Purpose |
|---|---|
IPlugin | Plugin interface, to be implemented by custom plugin DLLs (see explanation below) |
Plugin interface
This provides a standard COM interface for developers to connect a plug-in DLL which can render customized graphics on top of the map. Typically this is used to draw a dynamic layer of information on top of the map, for example for a tracking application where moving objects are plotted at their current position.
We can provide a sample “WMSSQL” plugin to demonstrate this including the Visual Basic source code. The WMSSQL plugin can plot point symbols at a location given by X Y coordinates resulting from a standard SQL query to a SQL Server or MS Access database.
The way a plugin works is very flexible: after drawing the map in a standard fashion, the DemisWMSMap.Server engine will call your plugin providing a standard “Device Context” (hDC) which you can address to use standard Windows GDI functions to draw additional graphics on top of the map. Once your plugin completes its rendering, it returns control to the WMS server which will compress the image into PNG/GIF/JPEG format and send this to the client as usual.
The Plugin DLL needs to implement the following properties and methods:
| Property | Type | Purpose |
|---|---|---|
ZOrder |
long | Set a layer index (0…n) to allow you to have the plugin called in between other layers in the map (default = 0 which means the plugin is always called last, after rendering all the layers in the map) |
| Method | Purpose |
|---|---|
RenderMap() | Is called on every WMS map request, allows the plugin to draw graphics using hDC (Device Context) |
RenderInfo() | Is called on every WMS feature info request, allows you to modify its normal output |
RenderCapabilities() | Is called on every capabilities request, allows you to modify its normal output |
For more information on the Plugin method arguments and usage, we suggest you ask us for the sample plugin for a working example.
SetThematicData
This function provides a way to define a thematic dataset by linking an array of numeric data to the objects in a particular (polygon) layer based on the object IDs. Any number of ranges can be specified by their maximum value and color. This type of thematic map is called a choropleth map where each polygon is rendered in a color depending on the range of its data value.
Syntax
object.SetThematicData(Layer, VcID, VcData, vLimits, vLabels, vColors)
| Argument | Type | Purpose |
|---|---|---|
Layer | String | Required. This is the name of the map layer that is used to visualize the data. |
VectorID | Array | Required. A Variant array of String values. This is the 1 dimensional array of IDs of map objects for which data can be referenced to the Layer. The IDs must exactly match those in the Layer. If an ID can’t be matched, the corresponding data is ignored. |
VectorData | Array | Required. A Variant array of Double values. This is the 1 dimensional array of data values that correspond to the VectorID array. These values will be rendered on the Layer as a choropleth map. |
RangeLimits | Array | Optional. A Variant array of Double values. A one dimensional array of limit values. This array must start at index 0! The first element is used to generate a lower bound for the first range (from index 0 to 1). If omitted automatic limits are used. |
RangeLabels | Array | Optional. A Variant array of String values. A one dimensional array of corresponding labels to the RangeLimits array. This array must start at index 1! The first element is the label of the first range (as defined in RangeLimits from index 0 to 1). If nothing then automatic labels are used. |
RangeColors | Array | Optional. A Variant array of Long values. A one dimensional array of corresponding colors (RGB value) to the RangeLimits array. This array must start at index 1! The first element is the color of the first range (as defined in RangeLimits from index 0 to 1). If omitted automatic colors are used. |
NullData | Double | Optional. Defines a data value which is used to indicate no data is present, i.e. -99999. |
By providing a layer name, two arrays of ID and thematic Data values and omitting the other arguments, an automatically generated “classification” will be generated, with a max value, color and label for each. To customize this classification you can provide one of your own using three additional arrays. An example script demonstrating this will be provided on request.
If you have any questions about this site send an e-mail to webmaster@demis.nl. For more information about Demis send an e-mail to contact@demis.nl.