Code example: requesting a wms layer, Wms and coordinate systems, Map and image bounds – Pitney Bowes MapXtreme User Manual

Page 347

Advertising
background image

Chapter 19: Web Map Service

Code Example: Requesting a WMS Layer

MapXtreme v7.1

354

Developer Guide

Code Example: Requesting a WMS Layer

To request a WMS layer programmatically with MapXtreme, follow the code example below.

L

MapXtreme’s implementation of WMS limits the size of the returned image to 4000 pixels
each for width and height.

// build the capabilities
ICapabilities capabilities = WmsClientUtilities.GetCapabilities

(url, "1.1.1");

// create the WMS client
WmsClient wmsClient = new WmsClient(capabilities);
wmsClient.AddLayer("WORLD");
wmsClient.Srs = "EPSG:4326";
wmsClient.BGColor = Color.Blue;
wmsClient.MimeType = "image/gif";

// create the table info
TableInfoWms wmsTableInfo= new TableInfoWms

("MyWmsTable", wmsClient);

// create the table
Table wmsTable = Session.Current.Catalog.OpenTable(wmsTableInfo);

// creates a FeatureLayer from the table entry
FeatureLayer featLyr = new FeatureLayer(wmsTable);

WMS and Coordinate Systems

MapXtreme provides support for three CRS authority coordinate systems that can be returned in a
GetCapabilities request.

CRS:84 - Longitude/latitude WGS 84. This is equivalent to EPSG:4236 in WMS 1.1.1.

CRS:83 - Longitude/latitude NAD 83. This is equivalent to EPSG:4269 in WMS 1.1.1.

CRS:27 - Longitude/latitude NAD 27. This is equivalent to EPSG:4267 in WMS 1.1.1.

In addition, the MapXtreme API provides a public method RegisterCRSCode() for you to register
other longitude/latitude projections in the CRS codespace.

Map and Image Bounds

EX_GeographicBoundingBox

The EX_GeographicBoundingBox is a new parameter for WMS 1.3.0 that defines the minimum
bounding rectangle of the layer in decimal degrees. Its purpose is to facilitate geographic searches
without requiring coordinate transformation by the search engine.

Advertising