comref

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. On 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 wil return the binary or text format output.

If you prefer to work with another scripting language like PHP, HTML/Javascript of 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, preferably using our user support forum.

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 next section)
SetThematicData(…) boolean Set a thematic datase for a vector layer, see 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 (defaul = “EPSG:4362”)
MaxHeight long Set a maximum height in pixels for ouput 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)
Abstract

ContactEmail

ContactOrganization

ContactPerson

KeywordList

LatLonXmin

LatLonXmax

LatLonYmin

LatLonYmax

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 disloags so there usually is no need to access them programatically.

 

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 DLL’s (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, by 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-Acess 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 it’s 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 it’s normal output
RenderCapabilities() Is called on every capabilities request, allows you to modify it’s normal output

For more information on the Plugin method arguments and usage, we suggest you download the sample plugin from our downloads page for a working example. Also we have a separate topic related to plugins in our user support forum

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 ID’s. Any number of ranges can be specified by their maximum value and color. This type of thematic map is called a Chloropleth 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 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 chloropleth 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