Pitney Bowes MapXtreme User Manual

Page 346

Advertising
background image

Chapter 19: Web Map Service

Understanding WMS Operations

MapXtreme v7.1

353

Developer Guide

You must supply the URL to the server you wish to reach. The version is optional. The MapXtreme
Client appends the required information following the ? in an HTTP request to make a complete
request of the server’s capabilities. For example:

http://www.mapsanddata.xyz/gis/services/maps/hydrography/MapServer/WMSSer
ver?request=GetCapabilities&service=WMS&version=1.3.0

If the version is not specified and you are accessing a MapXtreme WMS Server that supports both,
then the response for 1.3.0 is returned.

There is are overloaded methods that take an array of strings for the version number. The order of
the versions is dependent on what you are looking for. The first successful match is returned.

GetCapabilities also supports user defined parameters in a request. Use the method that takes a
NameValueCollection. See the Developer Reference for details.

The GetCapabilities response is returned in an XML document that MapXtreme reads and from
which it creates the capabilities object.

GetMap

MapXtreme takes care of calling GetMap for you when you place a table object representing the
request as a layer in your MapXtreme map. The code example below builds on the example in the

GetCapabilities

section.

// 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);

For more information on TableInfoWms see WMS in the

Supported Table Types on page 166

. See

also the TableInfoWms class in the Developer Reference.

GetFeatureInfo

The input for a GetFeatureInfo request are the bounds of a map and the pixel coordinates where the
user clicked on the map with an Info tool.

// Get the feature info

Byte[] info = WmsClientUtilities.GetFeatureInfo(new DRect(45.0, 45.0, 90,
90), 640, 480, new String[] {"WORLD"}, new Point(300,200), "text/xml"));

MemoryStream memoryStream = new MemoryStream(byteArray);
memoryStream.Seek(0, SeekOrigin.Begin);
XmlDocument doc = new XmlDocument();
doc.Load(memoryStream);
//parse the xml doc as desired.

Advertising