The WMService is an implementation of the
Open Geospatial Consortium's (OGC) Web Map Service (WMS) version 1.3.0 specification. The purpose of WMS is to provide an open and standardized way of publishing spatial data. This document will detail MapDotNet Server's implementation and tips to get it working. For a complete reference of WMS 1.3.0, please review the
specification.
MapDotNet Server's conforms to 'Basic WMS' as defined section 2.2 of the specification. This provides the following elements:
- GetCapabilities - provides information about the capabilities of this WMS (layers, formats, etc.)
- GetMap - returns a map image using the capabilities defined in GetCapabilities
Setting up a map for WMS
In order for a map to be served as a WMS through MapDotNet Server, it must specify its projection. This is necessary because the WMS must advertise its projection via GetCapabilities. This must be done using the 'PROJECTION' object in the mapfile (see the reference for details). Specifically, the map's projection must contain an EPSG keyword supported by Proj4. The list of which can be found in the proj directory installed with MDNS under nad\epsg.
Here is an example which uses WGS 84 (lat/long):
MAP
...
PROJECTION
"init=epsg:4326"
END
...
This is the only necessary configuration for WMS. However, there are optional parameters
- wms_crs - This is a space delimited list of supported CRS. These are the coordinate systems that this map will be able to be reprojected to. Examples are "epsg:2001", "CRS:83", "AUTO2:42001". See the WMS specification for more details.
- wms_extent - By default, the WMS uses the map's extents as the bounding box of the WMS. However, this can be overidden by setting wms_extent. The coordinates are assumed to be in the coordinate system of the map.
- wms_abstract - Provide a description of what this WMS provides.
- wms_maxwidth, wms_maxheight - These two settings prohibit image requests large than the given size (in pixels). This is good for prohibiting very large requests that may be stall the server.
These are set in the map's metadata. Example:
MAP
WEB
METADATA
"wms_crs" "EPSG:2001 AUTO2:42001 AUTO2:42002 AUTO2:42005 CRS:83"
"wms_extent" "-120.924308 22.753123 -47.247899 38.706338"
"wms_abstract" "Servers base data for the city of Tallahassee"
"wms_maxwidth" "2000"
"wms_maxheight" "2000"
END
...
The 'wms_abstract' can also be set in the layer metadata. Additionally, custom keywords can be added to layer metadata to facilitate searching (see 7.2.4.6.4 in the specification for details).
Additional Implementation Notes
- WMS Styles are not supported. None will appear in the GetCapabilities command, and the 'styles' parameter in the GetMap request will be ignored.
- CRS:1 is not supported. If specified in wms_crs, it will be ignored. This is the coordinate system for pixel coordinates.
- CRS:88 is not supported. If specified in wms_crs, it will be ignored. This is a vertical datumn (used for elevation).
Usage
Note: The below example URLs are abbreviated for clarity. They should be prefix with:
http:// <your hostname> /MapDotNetServer%20Web%20Service/
Where ' <your hostname> ' is replaced with the hostname of the server MDNS is installed on.
GetCapabilities:
WMService.aspx?mapId=<Your MapID>&request=GetCapabilities&service=WMS
This will return an XML document with the WMS's capabilities for a given map. From now on we will use 'test' as our map.
GetMap Examples:
A simple call:
WMService.aspx?mapId=test&request=GetMap&bbox=-84.6,30.3,-83.9,30.5&width=400&height=400&layers=City%20Limit
This will return a 400x400 map image at the extents given by bbox with the 'City Limit' layer visible.
Additional options can be added:
- we could add "format=image/gif" to change the output type.
- "transparent=true" would make the background transparent (if the image format supports it).
- "bgcolor=0xff0000" would set the background color to red given that transparent is not true. (Format is 0xRRGGBB)
Finally, reprojections are set with the "crs" parameter. The value must be one that is listed via GetCapabilities.