04.02.2013 Views

Web Map Service - MapInfo

Web Map Service - MapInfo

Web Map Service - MapInfo

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Map</strong>Info Corporate Headquarters:<br />

Phone: 518 285 6000<br />

Fax: 518 285 6070<br />

Sales: 800 327 8627<br />

Government Sales: 800 619 2333<br />

Technical Support: 518 285 7283<br />

www.mapinfo.com<br />

<strong>Map</strong>Info UK and EMEA Headquarters:<br />

Phone: 44 1753 848200<br />

Fax: 44 1753 621140<br />

Technical Support: 44 1753 848229<br />

www.mapinfo.co.uk<br />

<strong>Map</strong>Info Asia Pacific Headquarters:<br />

Phone: 61 2 9437 6255<br />

Fax: 61 2 9439 1773<br />

Technical Support: 61 7 3844 7744<br />

www.mapinfo.com.au<br />

© 2007 <strong>Map</strong>Info Corporation. All rights<br />

reserved. <strong>Map</strong>Info and the <strong>Map</strong>Info logo are<br />

trademarks of <strong>Map</strong>Info Corporation and/or<br />

its affiliates.<br />

June 6, 2007<br />

<strong>Web</strong> <strong>Map</strong> <strong>Service</strong><br />

<strong>Map</strong>Xtreme Java provides you with the ability to use a <strong>Web</strong> <strong>Map</strong> <strong>Service</strong> (WMS). The WMS lets<br />

an application render layers of geographic data onto a map image. WMS in <strong>Map</strong>Xtreme Java is<br />

1.1.1 compliant in accordance with the 1.1.1 OpenGIS® <strong>Web</strong> <strong>Map</strong> <strong>Service</strong> Implementation<br />

Specification. This document can be found at www.opengeospatial.org/standards/wms.<br />

Table of Contents<br />

� WMS Server Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1<br />

� GetCapabilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1<br />

� Get<strong>Map</strong> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5<br />

� GetFeatureInfo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6<br />

� WMS Raster Data Provider . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8<br />

� WMS Client . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8<br />

WMS Server Overview<br />

Using HTTP requests, the <strong>Web</strong> <strong>Map</strong> <strong>Service</strong> provides georeference data to a<br />

client that displays this data as an image. Georeference data is information<br />

associated with maps that describe the real world extents of specific features and<br />

the projection upon which it is based.<br />

In accordance with Open GIS Consortium’s <strong>Web</strong> <strong>Map</strong> <strong>Service</strong> Implementation<br />

Specification, WMS in <strong>Map</strong>Xtreme Java allows you to use the following<br />

operations:<br />

• GetCapabilities – returns service-level metadata. This metadata is a<br />

description of the information content and acceptable request parameters of<br />

the service.<br />

• Get<strong>Map</strong> – returns a map image with well-defined geospatial and dimensional<br />

parameters.<br />

• GetFeatureInfo – returns information about features shown on a map. This<br />

operation is optional.<br />

Note: All of these request types are case-sensitive.<br />

GetCapabilities<br />

When first finding a <strong>Web</strong> <strong>Map</strong> Server, it is necessary to find out the names of<br />

available layers, styles in use, spatial information in use, and other information<br />

that the server provides, in order to make a request for an image that is within the<br />

parameters of the server.<br />

GetCapabilities returns service-level metadata. This metadata is a description of<br />

the information content and acceptable request parameters of the service.<br />

1


Request Parameters<br />

The following table lists the possible request parameters.<br />

Sample Request<br />

The following is a sample GetCapabilities request:<br />

http://hostname:portnumber/wmsserver111/servlet/wms?SERVICE=WMS<br />

&REQUEST=GetCapabilities<br />

Sample Response<br />

Request Parameter<br />

The following is a sample GetCapabilities response:<br />

Required Description<br />

VERSION=version No Request version. <strong>Map</strong>Xtreme Java<br />

only supports version 1.1.1.<br />

SERVICE=WMS Yes <strong>Service</strong> type. The SERVICE<br />

attribute will always be set to<br />

WMS because that is all<br />

<strong>Map</strong>Xtreme Java currently<br />

supports.<br />

REQUEST=GetCapabilities Yes Request name<br />

- <br />

- <br />

OGC:WMS<br />

<strong>Map</strong>Info Corporation <strong>Map</strong> Server<br />

<br />

<br />

- <br />

- <br />

- <br />

application/vnd.ogc.wms_xml<br />

- <br />

- <br />

- <br />

<br />

<br />

- <br />

<br />

<br />

<br />

<br />

<br />

- <br />

image/gif<br />

image/jpeg<br />

image/jpg<br />

<strong>Map</strong>Xtreme Java: <strong>Web</strong> <strong>Map</strong> <strong>Service</strong> 2


image/png<br />

- <br />

- <br />

- <br />

<br />

<br />

- <br />

<br />

<br />

<br />

<br />

<br />

- <br />

text/xml<br />

- <br />

- <br />

- <br />

<br />

<br />

- <br />

<br />

<br />

<br />

<br />

<br />

<br />

- <br />

application/vnd.ogc.se_xml<br />

application/vnd.ogc.se_inimage<br />

application/vnd.ogc.se_blank<br />

<br />

- <br />

<strong>Map</strong>Info Corporation <strong>Map</strong> Server<br />

EPSG:4201<br />

EPSG:4205<br />

[...]<br />

<br />

- <br />

mistyles/brushes/brush_001<br />

brush_001<br />

<br />

[...]<br />

<br />

- <br />

Layers/World/Capitals<br />

World Capitals<br />

<br />

<br />

<br />

<strong>Map</strong>Xtreme Java: <strong>Web</strong> <strong>Map</strong> <strong>Service</strong> 3


- <br />

Layers/World/Countries<br />

World Countries<br />

<br />

<br />

<br />

- <br />

Layers/World/Grid<br />

Grid<br />

<br />

<br />

<br />

- <br />

Layers/World/Ocean<br />

Ocean (Robinson)<br />

<br />

<br />

<br />

<br />

<br />

Storing <strong>Service</strong> Element Information<br />

You can supply a service.xml file that stores the <strong>Service</strong> element information as defined by OGC. This service.xml file<br />

needs to conform to the OGC DTD and it needs to be located in the wmsserver111 context in the WEB-INF folder. The<br />

following is a sample service.xml file. The root element of the XML file needs to be or the XML file will be<br />

considered invalid and the getCapabilitiesRequest will fail.<br />

- <br />

OGC:WMS<br />

Custom <strong>Service</strong> title<br />

<br />

<br />

Caching GetCapabilities Requests<br />

<strong>Map</strong>Xtreme Java creates a capabilities.xml file at initialization time, that is used as a cache when <strong>Map</strong>Xtreme Java<br />

responds to GetCapabilities requests.<br />

You can modify this file to provide further customized information about your data. There is a new init param controlling<br />

the "lifetime" of this file. Here is a sample from its web.xml:<br />

<br />

<br />

maxAgeOfCapabilitiesXML<br />

-1<br />

<br />

<strong>Map</strong>Xtreme Java: <strong>Web</strong> <strong>Map</strong> <strong>Service</strong> 4


Get<strong>Map</strong><br />

To set the frequency rate in hours and minutes, use decimal values. For example to set the maximum age to 15<br />

minutes, set the parameter to 0.25.<br />

To clear the cache on the server or locally, you must implement com.mapinfo.util.CacheManager. See the Javadocs for<br />

more information.<br />

Get<strong>Map</strong> returns a map image with well-defined geospatial and dimensional parameters. When invoking Get<strong>Map</strong> a<br />

WMS Client can specify:<br />

• Layers<br />

• Styles<br />

• A bounding box<br />

• Coordinate reference system<br />

• Output format<br />

• Output size<br />

• Background transparency and color<br />

Request Parameters<br />

The following table lists the possible request parameters.<br />

Request Parameter Required Description<br />

VERSION=version Yes Request version. <strong>Map</strong>Xtreme Java only supports<br />

version 1.1.1.<br />

REQUEST=Get<strong>Map</strong> Yes Request name.<br />

LAYERS=layer_list Yes Comma-separated list of one or more map layers.<br />

STYLES=style_list Yes Comma-separated list of one rendering style per<br />

requested layer.<br />

SRS=namespace:identifier Yes Spatial Reference System.<br />

BBOX=minx,miny,maxx,maxy Yes Bounding box corners (lower left, upper right) in SRS<br />

units.<br />

WIDTH=output_width Yes Width in pixels of map picture.<br />

HEIGHT=output_height Yes Height in pixels of map picture.<br />

FORMAT=output_format Yes Output format of map.<br />

TRANSPARENT<br />

=TRUE|FALSE<br />

No Background transparency of map (default=FALSE).<br />

BGCOLOR=color_value No Hexadecimal red-green-blue color value for the<br />

background color (default=0xFFFFFF).<br />

EXCEPTIONS =exception_<br />

format<br />

WFS =web_feature_service_<br />

URL<br />

No The format in which exceptions are to be reported by the<br />

WMS (default=SE_XML).<br />

No URL of <strong>Web</strong> Feature <strong>Service</strong> providing features to be<br />

symbolized using Styled Layer Descriptor.<br />

<strong>Map</strong>Xtreme Java: <strong>Web</strong> <strong>Map</strong> <strong>Service</strong> 5


Sample Request<br />

The following is a sample Get<strong>Map</strong> request:<br />

http://hostname:portnumber/wmsserver111/servlet/wms?VERSION=1.1.1<br />

&SRS=epsg:4267&REQUEST=Get<strong>Map</strong>&LAYERS=Layers/World/Countries&STYLES=&BBOX=-180,<br />

-90,180,180&WIDTH=800&HEIGHT=600&FORMAT=image/gif<br />

Sample Response<br />

GetFeatureInfo<br />

The following is a sample Get<strong>Map</strong> response:<br />

GetFeatureInfo returns information about features shown on a map. This operation is optional. If GetFeatureInfo is<br />

employed, it must be issued after the Get<strong>Map</strong> request.<br />

Request Parameters<br />

The following table lists the possible request parameters.<br />

Request Parameter Required Description<br />

VERSION=version Yes Request version. <strong>Map</strong>Xtreme Java only supports<br />

version 1.1.1.<br />

REQUEST=GetFeatureInfo Yes Request name.<br />

Yes Partial copy of the <strong>Map</strong> request parameters that<br />

generated the map for which information is desired.<br />

QUERY_LAYERS=layer_list Yes Comma-separated list of one or more layers to be<br />

queried.<br />

INFO_FORMAT =output_format No Return format of feature information (MIME type).<br />

FEATURE_COUNT=number No Number of features about which to return information<br />

(default=1).<br />

X=pixel_column Yes X coordinate in pixels of feature (measured from upper<br />

left corner=0)<br />

<strong>Map</strong>Xtreme Java: <strong>Web</strong> <strong>Map</strong> <strong>Service</strong> 6


Sample Request<br />

The following is a sample GetFeatureInfo request:<br />

http://hostname:portnumber/wmsserver111/servlet/wms?VERSION=1.1.1<br />

&REQUEST=GetFeatureInfo&SRS=epsg:4326&LAYERS=Layers/World/Countries<br />

&STYLES=&BBOX=-180,-180,180,180&WIDTH=800&HEIGHT=600&QUERY_LAYERS=Layers/World/<br />

Countries&X=54&Y=54<br />

Sample Response<br />

Request Parameter Required Description<br />

Y=pixel_row Yes Y coordinate in pixels of feature (measured from upper<br />

left corner=0)<br />

EXCEPTIONS =exception_<br />

format<br />

The following is a sample GetFeatureInfo response:<br />

No The format in which exceptions are to be reported by<br />

the WMS (default=application/vnd.ogc.se_xml).<br />

- <br />

- <br />

world<br />

- <br />

- <br />

- <br />

-1.6194966287191512E7<br />

-8621185.324024437<br />

<br />

- <br />

1.6789976633244906E7<br />

8326222.646170927<br />

<br />

<br />

<br />

- <br />

- <br />

coordsys122<br />

mapinfo<br />

<br />

<br />

- <br />

Country<br />

Capital<br />

Pop_1994<br />

Pop_Grw_Rt<br />

Pop_Male<br />

Pop_Fem<br />

Pop_0_14<br />

Pop_15_64<br />

Pop_65Plus<br />

Male_0_14<br />

Male_15_64<br />

Male_65Plus<br />

Fem_0_14<br />

Fem_15_64<br />

Fem_65Plus<br />

Pop_Urban<br />

Pop_Rural<br />

<strong>Map</strong>Xtreme Java: <strong>Web</strong> <strong>Map</strong> <strong>Service</strong> 7


Pop_Urb_Male<br />

Pop_Urb_Fem<br />

Pop_Rur_Male<br />

Pop_Rur_Fem<br />

Arable_Pct<br />

Literacy<br />

Inflat_Rate<br />

Unempl_Rate<br />

Indust_Growth<br />

Continent<br />

<strong>Map</strong>Info_ID<br />

<br />

- <br />

<strong>Map</strong>Info_ID<br />

<br />

<br />

<br />

WMS Raster Data Provider<br />

WMS Client<br />

<strong>Map</strong>xtreme Java provides the classes WMSRasterDataProviderHelper and WMSRasterTableDescHelper that allow<br />

you to use any WMS v1.1.1 <strong>Web</strong> service to provide a layer to <strong>Map</strong>Xtreme Java programmatically to be rendered as<br />

part of a map. The WMS Raster Data Provider only allows you to render a layer. Any queries not related to rendering<br />

will either return an empty FeatureSet or meaningless results.<br />

Note: The only queries that will return valid results will be queries needed for rendering. Valid results will be returned<br />

from queryInRectangle.<br />

The class WMSRasterDataProviderHelper describes the location of the WMS 1.1.1 server to use. Use in conjunction<br />

with a WMSRasterTableDescHelper to add a layer to a <strong>Map</strong>J object based on a layer located on a WMS 1.1.1 server.<br />

<strong>Map</strong>Xtreme Java currently does not allow remote access to raster layers. As the WMS raster data provider provides<br />

raster information, it cannot be used for remote data access using the <strong>Map</strong>XtremeDataProviderRef.<br />

For more information, refer to these classes in the JavaDocs. For more on raster images, see the Developer Guide at<br />

http://reference.mapinfo.com/mapxtremejava.<br />

See also the sample application ImageConnectSample.java, located in the /<strong>Map</strong>Xtreme-4.8.0/<br />

examples/client/wms folder. This sample illustrates how to how to access the Image Connect <strong>Service</strong>, add an<br />

ImageConnect WMS raster layer, overlay it on a vector layer and display the result using Swing.<br />

<strong>Map</strong>Xtreme Java Edition provides the JSP WMS Custom Tags sample application to display sample functionality of a<br />

WMS client.<br />

You can access the JSP WMS Custom Tags by starting <strong>Map</strong>Xtreme Server and opening a browser and typing the URL<br />

to the sample, such as:<br />

http://[hostmachine:portnumber]/samples480/wms.jsp<br />

<strong>Map</strong>Xtreme Java: <strong>Web</strong> <strong>Map</strong> <strong>Service</strong> 8


WMS Client Interface Description<br />

This section describes the various items in the graphical user interface of the WMS client.<br />

Server List<br />

The following items are available in the Server List portion of the interface:<br />

• Add – adds a new server to the list and make its layers available to the add layer controls. Invalid WMS URLs are<br />

ignored.<br />

• Remove – removes the server from the list and removes any of its layers from the map.<br />

<strong>Map</strong> Tools<br />

The following items are available in the <strong>Map</strong> Tools portion of the interface:<br />

• ZoomIn/ZoomOut/Recenter – basic map tools for working with the map.<br />

• ZoomToAllLayers – change zoom to encompass all the visible layers on the map<br />

Layer Control<br />

The following items are available in the Layer Control portion of the interface:<br />

• Visibility(On/Off) – changes the visibility of a layer of the map.<br />

• Style Chooser – allows you to choose a style from a list of supported styles for the layer.<br />

• Move Layer (Up/Down) – changes the ordering of the layers of the map.<br />

• Remove Layer – adds or removes a layer that has been supplied from any of the available servers.<br />

• Add Layer – adds a layer that has been supplied from any of the available servers.<br />

• Refresh <strong>Map</strong> Data – redraws the map taking into account any layer visibility changes.<br />

<strong>Map</strong>Xtreme Java: <strong>Web</strong> <strong>Map</strong> <strong>Service</strong> 9


Using the WMS Client<br />

To use the WMS client:<br />

1. From the Server List portion of the interface, click Add. The Add Server dialog box displays.<br />

2. Enter the URL for the WMS 1.1.1 server that you want to use and click OK.<br />

3. From the WMS Layer Control portion of the interface, click Add. The Add Layer dialog box displays.<br />

4. Choose a server, layer and image type from the appropriate drop-down boxes and click OK.<br />

5. Use the controls described in WMS Client Interface Description on page 9 to work with the map.<br />

<strong>Map</strong>Xtreme Java: <strong>Web</strong> <strong>Map</strong> <strong>Service</strong> 10

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!