WMS GetMap GetCapabilities 参数详解

http://oceanesip.jpl.nasa.gov/esipde/guide.html

Online Viewer:

http://its.demo.galdosinc.com/wms/viewer/#

WMS source:
http://labs.metacarta.com/wms/vmap0
http://www2.demis.nl/mapserver/request.asp

Online sample:
http://openlayers.org/dev/examples/lite.html
http://trial.parcelstream.com/client/ver0_75/Samples/GoogleExternalWMSSample.html
http://wms-sites.com/catalog/Intergraph-US-sample-WMS/counties/

Guide to Distributing Your Data Products Via
WMS 1.1.1

A Tutorial for Data Providers

By Rob Raskin, Ocean ESIP, Jet Propulsion Lab

http://oceanesip.jpl.nasa.gov/esipde/guide.html
(Last updated Jan 2004)


This document provides assistance to data providers who would like to distribute their data products via the Web Mapping Server (WMS) protocol. This protocol was developed by the Open GIS Consortium (OGC) as a standard for transferring maps and georeferenced data over the Internet. If your data server complies with this standard, then users will be able to visualize your images or maps using a standard Web browser. Furthermore, users can overlay your products with other georeferenced maps, data, and imagery using a custom viewer.

If you are already providing spatial/temporal subsets from a web server, then WMS-compliance is relatively simple. Compliance involves a minimum of absolute requirements, plus several optional services. To be compliant, you must be able to deliver the following products via HTTP upon request:

1) User-selected spatial subsets (the GetMap request )
2) Metadata in an XML file (the GetCapabilities request).

You also must be able to deliver any error messages to the client in an XML file, in the event that either of the above requests are not satisfiable.

The first sections of this Guide detail the minimum requirements of WMS compliance. Later sections describe optional services that you may choose to provide beyond the minimum requirements.


GetMap

A WMS server must be able to deliver a map via http upon receiving a client request such as the following:

http://www.airesip.org/wms/process.cgi?REQUEST=GetMap&FORMAT=image/gif&WIDTH=640&HEIGHT=480&
LAYERS=temperature&SRS=EPSG:4326&BBOX=-110.,40.,-80.,30.&VERSION=1.1.1

In this hypothetical example, www.airesip.org is the server hostname, wms/ is its directory path, and process.cgi is the name of the CGI script processing the client requests. You can choose the directory path and file names. A question mark is appended after the script name to separate it from the parameter list. The parameter list consists of parameter name=value assignments separated by a an ampersand (&).

Parameters may appear in any order. Parameter names are not case-sensitive; therefore, height=480 and HEIGHT=480 are identical requests. However, you may choose to interpret parameter values as case-sensitive. No spaces appear anywhere in the request string. A description of each parameter is given below:

REQUEST
The parameter REQUEST=GetMap indicates that this request is for a map.

FORMAT
You choose which output formats to support. Permissible image formats include: image/gif, image/jpeg, image/tiff, image/geotiff, image/png, image/ppm, and image/wbmp. Several public domain and commercial software packages for creating images from numerical data will be listed in a future version of this Guide. (Note that TIFF and GeoTIFF support floating point data types as well as 16-bit integers, although not all TIFF/GeoTIFF readers support these features.)

WIDTHand HEIGHT
You must be able to provide images in any requested size. These values will be requested as positive integers.

LAYERS
You choose which layers (variables) to provide and how they are named. You must be able to receive a request for multiple layers (e.g. LAYERS=temperature,coastline,cities). In this example, temperature is drawn first, coastline is drawn on top of temperature, followed by cities.

SRS
You choose the map projection (or spatial reference system) (SRS) in which to deliver your data products. The SRS is commonly expressed in terms of its European Petroleum Survey Group (EPSG) numeric code. The standard latitude-longitude grid (with equal-angle increments and degrees as units) has a code of 4326, and would be sent as SRS=EPSG:4326. Other EPSG codes are listed in http://www.epsg.org . Alternatively, the SRS can be expressed as a projection with user-defined parameters and units, known as an AUTO projection. AUTO projections are described in http://www.digitalearth.gov/wmt/auto.html .

BBOX
The bounding box request is sent by the client as integers or floating point numbers (in units of the specified SRS). These values correspond to the outer edges of the boundary pixels (not the center of the boundary pixels). The aspect ratio inherent in this request need not match the aspect ratio of the width/height request, so you must be able to "stretch" the image to satisfy both requirements.

TRANSPARENT
You must be able to provide a transparent background image if the user requests it (using TRANSPARENT=TRUE) and the format is one that supports transparency. GIF and PNG support transparency, but JPEG does not. Note that GIF89 (rather than GIF87) is required to implement this feature for GIFs. Transparency enables other maps to be overlaid. If this parameter is not present in client requests, its value must be set to false.

BGCOLOR
You must be able to set the background (or missing value) color to the specified hex string (e.g. BGCOLOR=0xFF0000) if a user requests it. If this parameter is not present in client requests, its value must be set to white (0xFFFFFF) .

VERSION
The current version is 1.1.1.Your server will need to either support all official versions or support a "client-server negotiation" to meet a client request. All versions are listed at http://www.digitalearth.gov/wmt/xml .


GetCapabilities

The purpose of the GetCapabilities request is to declare the GetMap services that you provide. You must be able to deliver an XML metadata file via http upon receiving a request such as:

http://www.airesip.org/wms/process.cgi?REQUEST=GetCapabilities&VERSION=1.1.1&SERVICE=WMS

The URL need not be the same as that for GetMap. Therefore, you could arrange for another server to provide this functionality. You must be able to provide any GetMap service that you declare in the XML file. This file is to be returned with mime type set to "text/xml".

REQUEST
The parameter REQUEST=GetCapabilities indicates that this request is for metadata (rather than a map).

SERVICE
The parameter SERVICE=GetMap indicates that capabilities are being sought for a GetMap request.

A sample XML metadata file is shown below:

<?xml version='1.0' encoding="UTF-8" standalone="no" ?>
<!DOCTYPE WMT_MS_Capabilities SYSTEM "http://www.digitalearth.gov/wmt/xml/capabilities_1_1_1.dtd">
<WMT_MS_Capabilities version="1.1.1" updateSequence="0">
<Service>
<Name>Air ESIP</Name>
<Title>Air ESIP Map Server</Title>
<OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://www.airesip.org" />
</Service>
<Capability>
<Request>
<GetCapabilities>
<Format>WMS_XML</Format>
<DCPType><HTTP><Get>
<OnlineResource xmlns:xlink="http://w3.org/1999/xlink" xlink:type="simple" xlink:href="http://www.airesip.org/cgi-bin/de.xml" />
</Get></HTTP></DCPType>
</GetCapabilities>
<GetMap>
<Format>image/GIF</Format>
<Format>image/PNG</Format>
<DCPType><HTTP><Get>
<OnlineResource xmlns:xlink="http://w3.org/1999/xlink" xlink:type="simple" xlink:href="http://www.airesip.org/cgi-bin/de.pl" />
</Get></HTTP></DCPType>
</GetMap>
</Request>
<Exception>
<Format>application/vnd.ogc.se_xml</Format>
</Exception>
<Layer>
<Name>temperature</Name>
<Title>SeeAll Radiometer</Title>
<SRS>EPSG:4326</SRS>
<LatLonBoundingBox minx="-180" miny="-82" maxx="180" maxy="82" / >
<BoundingBox minx="-180" miny="-82" maxx="180" maxy="82" resx="1" resy="1" / >
</Layer>
</Capability>
</WMT_MS_Capabilities>

Lets look at some of the key parts of this file. The first three lines are header lines:

<?xml version='1.0' encoding="UTF-8" standalone="no" ?>
<!DOCTYPE WMT_MS_Capabilities SYSTEM "http://www.digitalearth.gov/wmt/xml/capabilities_1_1_1.dtd">
<WMT_MS_Capabilities version="1.1.1" updateSequence="0">

The first line identifies the code as XML. The second line gives the URL for the Document Type Definition (DTD) file. The DTD file is used to validate that your XML code has the correct structure. The third line provides version information, including an "updateSequence" number that is normally incremented every time a change has been made to the Capabilities file. This enables cataloging systems to determine quickly if an update to a server's holdings has occurred.

Next are <Service> and <Capability> tags.

<Service>
<Name>Air ESIP</Name>
<Title>Air ESIP Map Server</Title>
<OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://www.airesip.org" />
</Service>

The <Service> must include at a minimum: <Name>, <Title>, and <OnlineResource> (a web page providing further description of the site).

<Capability>
<Request>
...
</Request>
<Exception>
...
</Exception>
<Layer>
...
</Layer>
</Capability>

The <Capability> tag (note that this tag name is singular) includes <Request>, <Exception>, and <Layer> tags. <Request> consists of a <Map> and a <GetCapabilities> tag (note plural). The <GetMap> section describes the formats and request types available from the server for a GetMap request. The <GetCapabilities> tag describes what you get from a GetCapabilities request (which is the XML file itself).

<Request>
<GetCapabilities>
<Format>WMS_XML</Format>
<DCPType><HTTP><Get>
<OnlineResource xmlns:xlink="http://w3.org/1999/xlink" xlink:type="simple" xlink:href="http://www.airesip.org/cgi-bin/de.xml" />
</Get></HTTP></DCPType>
</GetCapabilities>
<GetMap>
<Format>image/GIF</Format>
<Format>image/PNG</Format>
<DCPType><HTTP><Get>
<OnlineResource xmlns:xlink="http://w3.org/1999/xlink" xlink:type="simple" xlink:href="http://www.airesip.org/cgi-bin/de.pl" />
</Get></HTTP></DCPType>
</GetMap>
</Request>

The <Exception> tag describes the format of the error message that is returned in the case of an incorrect request.
<Exception>
<Format>application/vnd.ogc.se_xml</Format>
</Exception>

See the Exception section below for further information.

Each <Layer> tag describes a layer that the server can provide:

<Layer>
<Name>temperature</Name>
<Title>SeeAll Radiometer</Title>
<SRS>EPSG:4326</SRS>
<LatLonBoundingBox minx="-180" miny="-82" maxx="180" maxy="82" />
<BoundingBox minx="-180" miny="-82" maxx="180" maxy="82" resx="1" resy="1" />
</Layer>

The <Name> tag gives the actual name that appears in the LAYER= parameter of a GetMap request. If a SRS other than latitude-longitude is used, the <LatLonBoundingBox> boundary can be approximate. A <Bounding Box> tag must be added either: i) if the spatial reference system is not lat-lon; or ii) to declare the native resolution of the data.

The Layer tag may include several parameters.
opaque=1 denotes that the map is mostly space-filling (generally the case with raster data) and should probably appear at the bottom of a stack of images.
queryable=1 denotes that GetFeatureInfo can be invoked on it.
fixedWidth=xxx denotes that the map width is fixed to the specified value
fixedHeight=xxx denotes that the map height is fixed to the specified value
nosubsets= 1 denotes that only the entire bounding box is accessible


Multiple Layer Descriptions

In most cases, your server will be providing more than a single layer (variable). Each layer is listed within its own <Layer> tag in the Capabilities file. The <Layer> tags can be nested when common properties apply to multiple layers. In the nested case, it is permissible for a nested layer to override the parent description.

It is a requirement to enclose multiple layers in a single outer <Layer> element. Properties common to all layers may be listed there, for convenience. In particular, any SRSs common to all layers should be listed there.


Time-Dependent Data

If you offer the same dataset at multiple time instances, you will want users to include a "time" parameter in their call. This parameter can be specified in many posible ways; some common examples are:

TIME=1999-12-23
TIME=1999-12-23T20:15
TIME=1999-12
TIME=1999-01-01,1999-04-01,1999-07-01,1999-10-01
TIME=1995-04-22T12:00/2000-06-21T12:00/P1D

The first example is for data on a particular day (December 23, 1999). The second form is more specific, as it references a particular time (20:15 on December 23, 1999). The third form is less specific, as it references a particular month. The fourth form is a request for four specific days of data. The fifth form is a request for daily data (P1D refers to a period of one day) during the specifed time interval. See http://www.digitalearth.gov/wmt/time.html for further time options.

To use Time for your datasets, you must declare Time to be a "Dimension" in the Capabilitites file and then specify the time "extent" of the dataset. The following pair of lines are an example of what would be placed within a layer tag group in the Capabilitites file:

<Dimension name="time" units="ISO8601" />
<Extent name="time" default="2000-12-24">1992-11-02/2000-12-24/P5D</Extent>

In this example, the data are provided every 5 days between 11/02/92 and 12/24/00. A default date is provided for those who do not specify a date.


Vertical Dimensions

If you offer the same dataset at multiple elevations, you will want users to include an "elevation" parameter in their getMap call. This parameter can be specified in many posible ways; the most common examples are:

ELEVATION=1000
ELEVATION=1000, 2000, 3000
ELEVATION=1000/5000/P1000

The first example is at an elevation of 1000 units. The second form is a request for three specific elevations. The third form is a request for every 1000 units between 1000 and 5000.

To use Elevation for your datasets, you must declare Elevation to be a "Dimension" in the Capabilitites file and then specify the elevation "extent" of the dataset. The following pair of lines are an example of what would be placed within a layer tag group in the Capabilitites file:

<Dimension name="elevation" units="EPSG:5030" />
<Extent name="elevation" default="0">0,2000,4000,6000,8000</Extent>

In this example, the data are provided every 2000 m between 0 and 8000. EPSG:5030 represents meters above the WGS84 ellipsoid. A default elevation is provided for those clients who do not specify it.


Additional Dimensions

In addition to 3-D space and time, your dataset may have other inherent "dimensions" such as spectral bands. In such cases you can create and declare dimensions of your own. For example, spectral band might be requested using calls such as:

BAND=0.8
BAND=0.6,0.8,1.8
BAND=0.8/1.8/P0.1

The first example is a request for a spectral band of 0.8 units. The second form is a request for three specific bands. The third form is a request for every 0.1 units between 0.8 and 1.8.

To use this (or any other dimension) in for your datasets, you must declare each to be a "Dimension" in the Capabilitites file and then specify the "extent" of the dimension. The following pair of lines are an example of what would be placed within a layer tag group in the Capabilitites file:

<Dimension name="band" units="micron" />
<Extent name="band" default="0.8">0.6/2.4/P0.1</Extent>

In this example, the data are provided every 0.1 micron between 0.6 and 2.4 microns. Its default value is 0.8.


Vendor Specific Parameters

You may choose to allow additional parameters in a GetMap request that are specific to your server, such as the minimum and maximum values on the color bar associated with a plot. These parameters must be declared in the Capabilities XML file, inside the <Capability> tag as in the following example.

<VendorSpecificCapabilities>
<MINVALUE>
<Title>Minimum Value</Title>
<Abstract>The lowest value to appear on the color scale.</Abstract>
</MINVALUE>
<MAXVALUE>
<Title>Maximum Value</Title>
<Abstract>The highest value to appear on the color scale.</Abstract>
</MAXVALUE>
</VendorSpecificCapabilities>

Clients are never required to include such a vendor specific parameter value in their requests. Therefore, your server must have default value set for each of these parameters.


Exceptions

If your server is unable to satisfy the client request, it must be able to provide some response to the client, preferably with an explanation of the inaction. At a minimum, you must be able to return this error message in the form of an XML file. You also may choose to provide two other methods to convey this message. The three options are:

  • (required) in an XML file (EXCEPTIONS=application/vnd.ogc.se_xml)
  • as a message "painted" onto the returned image (EXCEPTIONS=application/vnd.ogc.se_inimage)
  • as a last resort by returning a blank image (EXCEPTIONS=application/vnd.ogc.se_blank).
The exception methods that you support are listed in the Capabilities file, using the following form:

<Exception>
<Format>application/vnd.ogc.se_xml</Format>
<Format>application/vnd.ogc.se_inimage</Format>
</Exception>

An XML response must have its mime type set to: application/vnd.ogc.se_xml . The response XML file would appear in the following form:

<ServiceExceptionReport version="1.1.1">
<ServiceException>
Text of error message
</ServiceException>
</ServiceExceptionReport>


GetFeatureInfo

This option enables you to provide further information about a specific pixel in a previous GetMap request. You may choose to implement this service for any or all layers. The URL request resembles the GetMap request, but the user will also specify a single pixel. A typical request might be:

http://yourserver.ext/script.cgi?REQUEST=GetFeatureInfo &WIDTH=640&HEIGHT=480&BBOX=-110.,40.,-80.,30.
&VERSION=1.1.1 &SRS=EPSG:4326&QUERY_LAYERS=temperature&X=321&Y=165

Any layer that implements GetFeatureInfo should have its <Layer> tag in the Capabilities file replaced with <Layer queryable="1">.

REQUEST
The parameter REQUEST=GetFeatureInfo indicates that this request is for feature information (rather than metadata or a map).

WIDTH, HEIGHT, SRS, BBOX, VERSION, PARAMETERS
These are the same as in the GetMap request.

QUERY_LAYERS
Note the difference in the name of this parameter from the GetMap request. If multiple layers are being queried, they will be separated by commas.

X
The column number in the image where x= 0 is the leftmost column

Y
The row number in the image where y= 0 is the top row

INFO_FORMAT
You may choose the format in which to return the feature information, and this parameter can then be ignored.

FEATURE_COUNT
The user may choose to specify a maximum amount of information.


Styles

Your WMS server may provide maps in more than a single map style. The style names are of your choosing. Clients will send one map style for each layer requested in the GetMap request. Therefore if three layers were requested, this parameter might appear as STYLES=contour,contour,bold. If only a default style is provided, clients will send a null string (STYLES=) for this value. Styles should be declared within the <Layer> tag in the Capabilities file as in the following example:

<STYLE>
<Name>Contour</Name>
<Title>Contour Map</Title>
</STYLE>

Additional tags can optionally be added for <Abstract> and <StyleURL>. The StyleURL is commonly used by viewers as a legend or color scale. Note that such a legend is static, in that it must be the same for all requests for that layer. Future versions of WMS will enable rendering of dynamically determined color scales.


Additional Metadata Options

The <Service> tag of the Capabilities file may contain additional metadata describing the data product. The following tags have been defined and can be added to the Capabilities file: <Abstract>, <Keywords>, <Fees>, and <Access Constraint>.

The <Layer> tag of the Capabilities file may contain additional metadata describing a layer. The following tags have been defined for this purpose: <Abstract>, <Keywords>, <DataURL>, and <ScaleHint>. DataURL provides a way for viewers to provide additional information about particular layers via a link. ScaleHint gives the user some idea of the resolution of the data. This tag must include the two attributes min and max, representing the minimum and maximum scales that make sense for viewing that layer. These numbers are the corner-to-corner ground distance for a pixel near the center of the image.


Changes from WMS 1.1.0 to WMS 1.1.1

There are several changes in WMS 1.1.1 relative to 1.1.0. Some of the important changes are listed below:

Name Changes
The "WMTVER" keyword changes to "VERSION", the service "capabilities" becomes "GetCapabilities", the service "map" becomes "GetMap", and the service "feature_info" becomes "GetFeatureInfo". Image formats are now recognized with a "image/" preceding the image name (e.g. FORMAT="image/gif").

SERVICE=WMS
This statement is now required in the parameter list of getCapabilitites calls.

Dimensions
WMS now formally recognizes "dimensions", with the dimensions "Time" and "Elevation" having special qualitites.

Exceptions
Exception names and defaults have been changed.

Formats
Formats are now listed indivudiually, each within its own <Format> </Format> pair of tags.



Acknowledgements: Helpful comments have been provided by Jeff de la Beaujardiere, Tim Rhyne, and Matt Lynch.

Send comments to mailto:[email protected] .

<!-- Beginning of: /Templates/net_tracker_files/ntfooter.html --><!-- BEGIN: Use this section to set page specific variables for the NetTracker Page Tag -->

<!-- END: Use this section to set page specific variables for the NetTracker Page Tag --><!-- BEGIN: NetTracker Page Tag --><!-- Copyright 2004 Sane Solutions, LLC. All rights reserved. -->

<noscript></noscript> <!-- END: NetTracker Page Tag --><!-- End of: /Templates/net_tracker_files/ntfooter.html -->

你可能感兴趣的:(xml,ext,cgi,asp.net,AIR)