Communicating with a WMS service in a web browser
This topic shows how you can use URL parameters to communicate with a WMS service in a web browser.
WMS request and response
The online resource of each operation supported by a compliant WMS server is an HTTP uniform resource locator (URL), so a WMS service can be considered as a Representational State Transfer (REST) service. Unlike a standard web service, a SOAP client is not necessary for consuming a WMS service, and a web browser is the simplest client. You can get a WMS service's service-level metadata, a map image, or attribute values of a feature by sending a URL request to the server and viewing the corresponding responses in the browser either as an XML document or an image.
Below are some sample requests and responses for each operation supported by a WMS service.
GetCapabilities
Request
XML response
<WMS_Capabilities version="1.3.0" xsi:schemaLocation="http://www.opengis.net/wms http://schemas.opengis.net/wms/1.3.0/capabilities_1_3_0.xsd http://www.esri.com/wms http://sampleserver1a.arcgisonline.com/ArcGIS/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer/WMSServer?version=1.3.0&service=WMS&request=GetSchemaExtension">
<Service>
<Name>WMS</Name>
<Title>Specialty/ESRI_StatesCitiesRivers_USA</Title>
<Abstract>WMS</Abstract>
<KeywordList>
<Keyword></Keyword>
</KeywordList>
<OnlineResource xlink:type="simple" xlink:href="http://sampleserver1a.arcgisonline.com/ArcGIS/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer/WMSServer"/>
<ContactInformation>
<ContactPersonPrimary>
<ContactPerson></ContactPerson>
<ContactOrganization></ContactOrganization>
</ContactPersonPrimary>
<ContactPosition></ContactPosition>
<ContactAddress>
<AddressType></AddressType>
<Address></Address>
<City></City>
<StateOrProvince></StateOrProvince>
<PostCode></PostCode>
<Country></Country>
</ContactAddress>
<ContactVoiceTelephone></ContactVoiceTelephone>
<ContactFacsimileTelephone></ContactFacsimileTelephone>
<ContactElectronicMailAddress></ContactElectronicMailAddress>
</ContactInformation>
<Fees></Fees>
<AccessConstraints></AccessConstraints>
<MaxWidth>2048</MaxWidth>
<MaxHeight>2048</MaxHeight>
</Service>
<Capability>
<Request>
<GetCapabilities>
<Format>application/vnd.ogc.wms_xml</Format>
<Format>text/xml</Format>
<DCPType>
<HTTP>
<Get>
<OnlineResource xlink:type="simple" xlink:href="http://sampleserver1a.arcgisonline.com/ArcGIS/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer/WMSServer"/>
</Get>
</HTTP>
</DCPType>
</GetCapabilities>
<GetMap>
<Format>image/bmp</Format>
<Format>image/jpeg</Format>
<Format>image/tiff</Format>
<Format>image/png</Format>
<Format>image/png8</Format>
<Format>image/png24</Format>
<Format>image/png32</Format>
<Format>image/gif</Format>
<Format>image/svg+xml</Format>
<DCPType>
<HTTP>
<Get>
<OnlineResource xlink:type="simple" xlink:href="http://sampleserver1a.arcgisonline.com/ArcGIS/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer/WMSServer"/>
</Get>
</HTTP>
</DCPType>
</GetMap>
<GetFeatureInfo>
<Format>application/vnd.esri.wms_raw_xml</Format>
<Format>application/vnd.esri.wms_featureinfo_xml</Format>
<Format>application/vnd.ogc.wms_xml</Format>
<Format>text/xml</Format>
<Format>text/html</Format>
<Format>text/plain</Format>
<DCPType>
<HTTP>
<Get>
<OnlineResource xlink:type="simple" xlink:href="http://sampleserver1a.arcgisonline.com/ArcGIS/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer/WMSServer"/>
</Get>
</HTTP>
</DCPType>
</GetFeatureInfo>
<esri_wms:GetStyles>
<Format>application/vnd.ogc.sld+xml</Format>
<DCPType>
<HTTP>
<Get>
<OnlineResource xlink:type="simple" xlink:href="http://sampleserver1a.arcgisonline.com/ArcGIS/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer/WMSServer"/>
</Get>
</HTTP>
</DCPType>
</esri_wms:GetStyles>
</Request>
<Exception>
<Format>application/vnd.ogc.se_xml</Format>
<Format>application/vnd.ogc.se_inimage</Format>
<Format>application/vnd.ogc.se_blank</Format>
<Format>text/xml</Format>
<Format>XML</Format>
</Exception>
<Layer>
<Title>Layers</Title>
<CRS>CRS:84</CRS>
<CRS>EPSG:4326</CRS>
<EX_GeographicBoundingBox>
<westBoundLongitude>-125.192865</westBoundLongitude>
<eastBoundLongitude>-66.105824</eastBoundLongitude>
<southBoundLatitude>19.416377</southBoundLatitude>
<northBoundLatitude>54.318281</northBoundLatitude>
</EX_GeographicBoundingBox>
<BoundingBox CRS="CRS:84" minx="-125.192865" miny="19.416377" maxx="-66.105824" maxy="54.318281"/>
<BoundingBox CRS="EPSG:4326" minx="19.416377" miny="-125.192865" maxx="54.318281" maxy="-66.105824"/>
<Layer queryable="1">
<Name>0</Name>
<Title>States</Title>
<Abstract>States</Abstract>
<CRS>CRS:84</CRS>
<CRS>EPSG:4326</CRS>
<EX_GeographicBoundingBox>
<westBoundLongitude>-178.217598</westBoundLongitude>
<eastBoundLongitude>-66.969271</eastBoundLongitude>
<southBoundLatitude>18.924782</southBoundLatitude>
<northBoundLatitude>71.406235</northBoundLatitude>
</EX_GeographicBoundingBox>
<BoundingBox CRS="CRS:84" minx="-178.217598" miny="18.924782" maxx="-66.969271" maxy="71.406235"/>
<BoundingBox CRS="EPSG:4326" minx="18.924782" miny="-178.217598" maxx="71.406235" maxy="-66.969271"/>
<Style>
<Name>default</Name>
<Title>0</Title>
<LegendURL width="76" height="16">
<Format>image/png</Format>
<OnlineResource xlink:href="http://sampleserver1a.arcgisonline.com/ArcGIS/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer/WMSServer?request=GetLegendGraphic%26version=1.3.0%26format=image/png%26layer=0" xlink:type="simple"/>
</LegendURL>
</Style>
</Layer>
<Layer queryable="1">
<Name>1</Name>
<Title>Rivers</Title>
<Abstract>Rivers</Abstract>
<CRS>CRS:84</CRS>
<CRS>EPSG:4326</CRS>
<EX_GeographicBoundingBox>
<westBoundLongitude>-164.765831</westBoundLongitude>
<eastBoundLongitude>-67.790980</eastBoundLongitude>
<southBoundLatitude>25.845557</southBoundLatitude>
<northBoundLatitude>70.409756</northBoundLatitude>
</EX_GeographicBoundingBox>
<BoundingBox CRS="CRS:84" minx="-164.765831" miny="25.845557" maxx="-67.790980" maxy="70.409756"/>
<BoundingBox CRS="EPSG:4326" minx="25.845557" miny="-164.765831" maxx="70.409756" maxy="-67.790980"/>
<Style>
<Name>default</Name>
<Title>1</Title>
<LegendURL width="76" height="16">
<Format>image/png</Format>
<OnlineResource xlink:href="http://sampleserver1a.arcgisonline.com/ArcGIS/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer/WMSServer?request=GetLegendGraphic%26version=1.3.0%26format=image/png%26layer=1" xlink:type="simple"/>
</LegendURL>
</Style>
</Layer>
<Layer queryable="1">
<Name>2</Name>
<Title>Cities</Title>
<Abstract>Cities</Abstract>
<CRS>CRS:84</CRS>
<CRS>EPSG:4326</CRS>
<EX_GeographicBoundingBox>
<westBoundLongitude>-158.064606</westBoundLongitude>
<eastBoundLongitude>-67.986769</eastBoundLongitude>
<southBoundLatitude>19.696150</southBoundLatitude>
<northBoundLatitude>64.869104</northBoundLatitude>
</EX_GeographicBoundingBox>
<BoundingBox CRS="CRS:84" minx="-158.064606" miny="19.696150" maxx="-67.986769" maxy="64.869104"/>
<BoundingBox CRS="EPSG:4326" minx="19.696150" miny="-158.064606" maxx="64.869104" maxy="-67.986769"/>
<Style>
<Name>default</Name>
<Title>2</Title>
<LegendURL width="72" height="16">
<Format>image/png</Format>
<OnlineResource xlink:href="http://sampleserver1a.arcgisonline.com/ArcGIS/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer/WMSServer?request=GetLegendGraphic%26version=1.3.0%26format=image/png%26layer=2" xlink:type="simple"/>
</LegendURL>
</Style>
</Layer>
</Layer>
</Capability>
</WMS_Capabilities>
GetMap
Request
Response map
Request
http://gisserver.domain.com:6080/arcgis/services/folder/service/MapServer/WMSServer?REQUEST=GetMap&SERVICE=WMS&VERSION=1.3.0&LAYERS=0&STYLES=&FORMAT=image/png&BGCOLOR=0xFFFFFF&TRANSPARENT=TRUE&CRS=EPSG:4326&BBOX=17.9995833333334,-161.000416666667,23.0004166666666,-153.999583333333&WIDTH=981&HEIGHT=826&DIM_DEPTH=2000
GetMap from mosaic datasets
For WMS services originating from mosaic datasets, TIME and IMAGES parameters can be added.
Time
TIME—Supports time queries by specifying a time instance or time range. The format can be YYYYMMDDHHMMSS, YYYYMMDD, YYYYMM, or YYYY.
TIME=1999 (time at year 1999)
Request
http://gisserver.domain.com:6080/arcgis/services/folder/service/ImageServer/WMSServer?REQUEST=GetMap&SERVICE=WMS&VERSION=1.3.0&LAYERS=0&STYLES=&FORMAT=image/png&BGCOLOR=0xFFFFFF&TRANSPARENT=TRUE&CRS=EPSG:4326&BBOX=17.9995833333334,-161.000416666667,23.0004166666666,-153.999583333333&WIDTH=981&HEIGHT=826&TIME=1999
TIME=1980/2010 (time from year 1980 to 2010)
Request
http://gisserver.domain.com:6080/arcgis/services/folder/service/ImageServer/WMSServer?REQUEST=GetMap&SERVICE=WMS&VERSION=1.3.0&LAYERS=0&STYLES=&FORMAT=image/png&BGCOLOR=0xFFFFFF&TRANSPARENT=TRUE&CRS=EPSG:4326&BBOX=17.9995833333334,-161.000416666667,23.0004166666666,-153.999583333333&WIDTH=981&HEIGHT=826&TIME=1980/2010
TIME=1999-12-31T14:30:30/2000-01-01T14:30:30
Request
http://gisserver.domain.com:6080/arcgis/services/folder/service/ImageServer/WMSServer?REQUEST=GetMap&SERVICE=WMS&VERSION=1.3.0&LAYERS=0&STYLES=&FORMAT=image/png&BGCOLOR=0xFFFFFF&TRANSPARENT=TRUE&CRS=EPSG:4326&BBOX=17.9995833333334,-161.000416666667,23.0004166666666,-153.999583333333&WIDTH=981&HEIGHT=826&TIME=1999-12-31T14:30:30/2000-01-01T14:30:30
Images
IMAGES—Supports query of individual rasters
Request
http://gisserver.domain.com:6080/arcgis/services/folder/service/ImageServer/WMSServer?REQUEST=GetMap&SERVICE=WMS&VERSION=1.3.0&LAYERS=0&STYLES=&FORMAT=image/png&BGCOLOR=0xFFFFFF&TRANSPARENT=TRUE&CRS=EPSG:4326&BBOX=17.9995833333334,-161.000416666667,23.0004166666666,-153.999583333333&WIDTH=981&HEIGHT=826&images=1
IMAGES=1,2 (where the numbers are the object IDs of the image service catalog table)
Request
http://gisserver.domain.com:6080/arcgis/services/folder/service/ImageServer/WMSServer?REQUEST=GetMap&SERVICE=WMS&VERSION=1.3.0&LAYERS=0&STYLES=&FORMAT=image/png&BGCOLOR=0xFFFFFF&TRANSPARENT=TRUE&CRS=EPSG:4326&BBOX=17.9995833333334,-161.000416666667,23.0004166666666,-153.999583333333&WIDTH=981&HEIGHT=826&images=1,2
GetFeatureInfo
Request
XML response
<FeatureInfoResponse>
<FIELDS FID="14" Shape="Null" AREA="77330.258" STATE_NAME="Nebraska" STATE_FIPS="31" SUB_REGION="W N Cen"
STATE_ABBR="NE" POP1990="1578385" POP1999="1671251" POP90_SQMI="20" HOUSEHOLDS="602363" MALES="769439"
FEMALES="808946" WHITE="1480558" BLACK="57404" AMERI_ES="12410" ASIAN_PI="12422" OTHER="15591"
HISPANIC="36969" AGE_UNDER5="119606" AGE_5_17="309406" AGE_18_29="281105" AGE_30_49="441470"
AGE_50_64="203730" AGE_65_UP="223068" NEVERMARRY="295873" MARRIED="719288" SEPARATED="13552"
WIDOWED="96052" DIVORCED="90230" HSEHLD_1_M="63686" HSEHLD_1_F="95985" MARHH_CHD="171428"
MARHH_NO_C="179086" MHH_CHILD="7603" FHH_CHILD="34583" HSE_UNITS="660621" VACANT="58258"
OWNER_OCC="400394" RENTER_OCC="201969" MEDIAN_VAL="50400" MEDIANRENT="282" UNITS_1DET="479124"
UNITS_1ATT="15767" UNITS2="18369" UNITS3_9="46246" UNITS10_49="49402" UNITS50_UP="9656"
MOBILEHOME="37046" NO_FARMS87="60502" AVG_SIZE87="749" CROP_ACR87="23320162" AVG_SALE87="110197"/>
</FeatureInfoResponse>
GetStyles
Request
XML response
<sld:StyledLayerDescriptor version="1.0.0" xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd">
<!-- layer "0" -->
<sld:NamedLayer>
<sld:Name>0</sld:Name>
<!-- NamedStyle -->
<sld:NamedStyle>
<sld:Name>default</sld:Name>
</sld:NamedStyle>
<!-- UserStyle -->
</sld:NamedLayer>
<!-- layer "1" -->
<sld:NamedLayer>
<sld:Name>1</sld:Name>
<!-- NamedStyle -->
<sld:NamedStyle>
<sld:Name>default</sld:Name>
</sld:NamedStyle>
<!-- UserStyle -->
</sld:NamedLayer>
<!-- layer "2" -->
<sld:NamedLayer>
<sld:Name>2</sld:Name>
<!-- NamedStyle -->
<sld:NamedStyle>
<sld:Name>default</sld:Name>
</sld:NamedStyle>
<!-- UserStyle -->
</sld:NamedLayer>
</sld:StyledLayerDescriptor>
GetLegendGraphic
Request
Response legend graphic
In many cases, a web browser may not be a preferred WMS client, but it is always a good tool to track and debug the communication between a WMS server and client.
WMS request parameters
OGC Web Map Service specifications define a complete list of request parameters that can be used in each WMS operation. See the links below for different versions of the OGC WMS implementation specification:
The tables below list all the request parameters that are applicable to the WMS implementation, which is only a subset of those defined in the specification.
Parameters of a WMS GetCapabilities request URL
Mandatory/Optional |
Default value |
Description | |
---|---|---|---|
VERSION/WMTVER |
Optional |
1.3.0 (9.3 and up) 1.1.1 (9.2) |
Request version. Only use WMTVER in WMS 1.0.0; otherwise, use VERSION. |
SERVICE |
Mandatory |
N/A |
Service type. It must be set to WMS. The parameter is not available in WMS 1.0.0. |
REQUEST |
Mandatory |
N/A |
Request name. It must be set to GetCapabilities. For WMS 1.0.0, it must be set to capabilities. |
FORMAT |
Optional |
text/xml (9.3 and up) |
Output format for service metadata. This is only available in WMS 1.3.0 (for example, application/vnd.ogc.wms_xml or text/plain or text/html). |
Parameters of a WMS GetMap request URL
Mandatory/Optional |
Default value |
Description | |
---|---|---|---|
VERSION/WMTVER |
Mandatory |
N/A |
Request version. Only use WMTVER in WMS 1.0.0; otherwise, use VERSION. |
REQUEST |
Mandatory |
N/A |
Request name. It must be set to GetMap. For WMS 1.0.0, it must be set to map. |
LAYERS |
Mandatory |
N/A |
Comma-separated list of one or more map layers (for example, 0,1,2 or layer1,layer2). |
STYLES |
Mandatory |
N/A |
Comma-separated list of one or more styles, one style per requested layer (for example, 0,1,2 or style1,style2). |
CRS/SRS |
Mandatory |
N/A |
Coordinate reference system. CRS is only used in WMS 1.3.0; otherwise, use SRS (for example, EPSG:4326 or EPSG:4269). |
BBOX |
Mandatory |
N/A |
Bounding box corners (lower left and upper right) in CRS/SRS units (for example, -180,-90,180,90). |
WIDTH |
Mandatory |
N/A |
Width in pixels of map picture (for example, 1024). |
HEIGHT |
Mandatory |
N/A |
Height in pixels of map picture (for example, 768). |
FORMAT |
Mandatory |
N/A |
Output format of map (for example, image/png or image/jpeg or image/svg+xml or image/bil). If you're specifying the output format as image/bil, the WMS client will also need to generate a corresponding header (.hdr) to read the images properly. |
TRANSPARENT |
Optional |
False |
Determines whether background is transparent or not (True or False, respectively). |
BGCOLOR |
Optional |
0xFFFFFF |
Hexadecimal RGB color for the map background (for example, 0xFFFFFF or FFFFFF). |
SLD |
Optional |
"" |
URL of Styled Layer Descriptor XML file. |
SLD_BODY | Optional | "" | XML body of Styled Layer Descriptor file. |
TIME | Optional | "" | Time value of requested layer. ArcGIS client applications only support the TIME dimension if the layer is time-enabled. If the layer is not time-enabled, you'll need to use a web browser or custom client to submit a GetMap request using the DIM_ parameter (listed below). |
EXCEPTIONS |
Optional |
text/xml (WMS 1.3.0) application/vnd.ogc.se_xml (WMS 1.1.1 and WMS 1.1.0) application/vnd.ogc.inimage (WMS 1.0.0) |
The format in which exceptions should be reported (for example, text/xml or text/html). |
DIM_<name> | Optional | "" | Dimension value of the requested map layers. <name> must be replaced with the name of a dimension, for example, DEPTH. DIM_ is supported in WMS 1.1.0 and above. It is only available through WMS services derived from map services. WMS services derived from image services do not support DIM_. Dimensions are not currently supported through ArcGIS client applications. To consume dimensions, you'll need to use a web browser or create your own custom OGC client application using ArcObjects or another language. |
Parameters of a WMS GetFeatureInfo request URL
Mandatory/Optional |
Default value |
Description | |
---|---|---|---|
VERSION/WMTVER |
Mandatory |
N/A |
Request version. Only use WMTVER in WMS 1.0.0; otherwise, use VERSION. |
REQUEST |
Mandatory |
N/A |
Request name. It must be set to GetFeatureInfo. For WMS 1.0.0, it must be set to feature_info. |
Map request part |
Mandatory |
N/A |
Partial copy of the GetMap request parameters that generated the map for which information is desired. |
QUERY_LAYERS |
Mandatory |
N/A |
Comma-separated list of one or more map layers to be queried (for example, 0,1,2 or layer1,layer2). |
INFO_FORMAT |
Mandatory (WMS 1.3.0) Optional (WMS 1.1.1, 1.1.0, 1.0.0) |
N/A (WMS 1.3.0) text/xml (WMS 1.1.1, 1.1.0, 1.0.0) |
Return format of feature information (for example, text/xml, text/html). |
I/X |
Mandatory |
N/A |
X-coordinate in pixels of feature in map coordinate system (for example, 100). Use I for WMS 1.3.0; otherwise use X. |
J/Y |
Mandatory |
N/A |
Y-coordinate in pixels of feature in map coordinate system (for example, 100). Use J for WMS 1.3.0; otherwise, use Y. |
TIME | Optional | "" | Time value of requested layer. ArcGIS client applications only support the TIME dimension if the layer is time-enabled. If the layer is not time-enabled, you'll need to use a web browser or custom client to submit a GetMap request using the DIM_ parameter (listed below). |
EXCEPTIONS |
Optional |
text/xml (WMS 1.3.0) application/vnd.ogc.se_xml (WMS 1.1.1 and WMS 1.1.0) application/vnd.ogc.inimage (WMS 1.0.0) |
The format in which exceptions should be reported (for example, text/xml or text/html). |
DIM_<name> | Optional | "" | Dimension value of the requested map layers. <name> must be replaced with the name of a dimension, for example, DEPTH. DIM_ is supported in WMS 1.1.0 and above. It is only available through WMS services derived from map services. WMS services derived from image services do not support DIM_. Dimensions are not currently supported through ArcGIS client applications. To consume dimensions, you'll need to use a web browser or create your own custom OGC client application using ArcObjects or another language. |
Parameters of a WMS GetStyles request
Mandatory/Optional |
Default value |
Description | |
---|---|---|---|
VERSION |
Mandatory |
1.3.0 (9.3 and up) 1.1.1 (9.2) |
Version as required by OGC interfaces. |
REQUEST |
Mandatory |
N/A |
Request name. It must be set to GetStyles. |
LAYERS |
Mandatory |
N/A |
Comma-separated list of named layers for which to retrieve style descriptions. |
SLDVER |
Optional |
1.0.0 (10.0) |
The SLD version requested for the SLD document. Only version 1.0.0 is supported. |
Parameters of a WMS GetLegendGraphic request
Mandatory/Optional |
Default value |
Description | |
---|---|---|---|
VERSION |
Mandatory |
1.3.0 (9.3 and up) 1.1.1 (9.2) |
Version as required by OGC interfaces. |
REQUEST |
Mandatory |
N/A |
Request name. It must be set to GetLegendGraphic. |
LAYER |
Mandatory |
N/A |
Layer for which to produce the legend graphic. |
STYLE |
Optional |
default |
Style of layer for which to produce the legend graphic. If not present, the default style is selected. The style may be any valid style available for a layer, including non-SLD internally defined styles. |
RULE | Optional | "" | Style rule for which to produce the legend graphic, if applicable. When a style has multiple rules but no specific rule is selected, the map service is obligated to produce a graphic that is representative of all the rules of the style. |
SLD | Optional | "" | Specifies a reference to an SLD document. It works in the same way as the SLD= parameter of the WMS GetMap operation. |
SLD_BODY | Optional | "" | Allows an SLD document to be included directly in an HTTP GET request. It works in the same way as the SLD_BODY parameter of the WMS GetMap operation. |
FORMAT | Optional | image/png (png24) | The MIME type of the file format in which to return the legend graphic. Allowed values are the same as for the FORMAT= parameter of the WMS GetMap request. |
WIDTH | Optional | Depends on the specific legend image | Gives a hint for the width of the returned graphic in pixels. |
HEIGHT | Optional | Depends on the specific legend image | Gives a hint for the height of the returned graphic in pixels. |
EXCEPTIONS | Optional | text/xml (WMS 1.3.0) application/vnd.ogc.se_xml (WMS 1.1.1 and WMS 1.1.0) application/vnd.ogc.inimage (WMS 1.0.0) | The MIME type of the format in which to return exceptions. Allowed values are the same as for the EXCEPTIONS= parameter of the WMS GetMap request. |