OGC——WMS服务

一、引言

        一直用arcgis javascript的二次开发,经常使用它的一些服务WMS、WMTS、WFS、MapService等,并没有深入了解这些服务内部机制,直到最近学习了geoserver,由于毕竟它是开源的要遵循行业老大OGC制定的标准,这样通用性比较强一些,所以发的服务基本都是WMS、WTMS、WFS、WCS==

        so了解这些东西是必须的了,后悔当时没有跟遥感院第一美男老师好好学啊,现在开始看着还是懵逼状态,硬着头皮看完梳理了一下==

 

二、WMS服务发布

        这里可以用geoserver发布,也可以用arcgisserver或者mapserver,由于我经常使用arcgis,这里用了arcgis server发布的。发布很简单==

        这里只要比正常发布的时候多勾个选项就可以了。发布后的服务如下面右图:

OGC——WMS服务_第1张图片    OGC——WMS服务_第2张图片

 

三、WMS服务中的操作

 
WMS提供了以下的操作
 

WMS requests can perform the following operations:

OGC——WMS服务_第3张图片

3.1GetCapabilities(获取服务中的要素类及支持的操作)

3.1.1基本介绍


The GetCapabilities operation requests metadata about the operations, services, and data (“capabilities”) that are offered by a WMS server.

The parameters for the GetCapabilities operation are:
OGC——WMS服务_第4张图片

3.1.2举例介绍

请求方式:http://localhost:6080/arcgis/services/tttt/tt/MapServer/WMSServer?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilities

这里主要就是三个参数,request就是WMS的操作方法,这里是GetCapabilities

请求结果:

这里看着比较复杂,一下子肯定看不懂,后面可以慢慢理解,这个内容很有用的==

<WMS_Capabilities xmlns="http://www.opengis.net/wms" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:esri_wms="http://www.esri.com/wms" 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://localhost:6080/arcgis/services/tttt/tt/MapServer/WmsServer?version=1.3.0%26service=WMS%26request=GetSchemaExtension">
<Service>
<Name>
 WMS ]]>
Name>
<Title>
 tttt_tt ]]>
Title>
<Abstract>WMSAbstract>
<KeywordList>
<Keyword>
 ]]>
Keyword>
KeywordList>
<OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://localhost:6080/arcgis/services/tttt/tt/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>4096MaxWidth>
<MaxHeight>4096MaxHeight>
Service>
<Capability>
<Request>
<GetCapabilities>
<Format>application/vnd.ogc.wms_xmlFormat>
<Format>text/xmlFormat>
<DCPType>
<HTTP>
<Get>
<OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://localhost:6080/arcgis/services/tttt/tt/MapServer/WmsServer?"/>
Get>
HTTP>
DCPType>
GetCapabilities>
<GetMap>
<Format>image/bmpFormat>
<Format>image/jpegFormat>
<Format>image/tiffFormat>
<Format>image/pngFormat>
<Format>image/png8Format>
<Format>image/png24Format>
<Format>image/png32Format>
<Format>image/gifFormat>
<Format>image/svg+xmlFormat>
<DCPType>
<HTTP>
<Get>
<OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://localhost:6080/arcgis/services/tttt/tt/MapServer/WmsServer?"/>
Get>
HTTP>
DCPType>
GetMap>
<GetFeatureInfo>
<Format>application/vnd.esri.wms_raw_xmlFormat>
<Format>application/vnd.esri.wms_featureinfo_xmlFormat>
<Format>application/vnd.ogc.wms_xmlFormat>
<Format>text/xmlFormat>
<Format>text/htmlFormat>
<Format>text/plainFormat>
<DCPType>
<HTTP>
<Get>
<OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://localhost:6080/arcgis/services/tttt/tt/MapServer/WmsServer?"/>
Get>
HTTP>
DCPType>
GetFeatureInfo>
<esri_wms:GetStyles>
<Format>application/vnd.ogc.sld+xmlFormat>
<DCPType>
<HTTP>
<Get>
<OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://localhost:6080/arcgis/services/tttt/tt/MapServer/WmsServer?"/>
Get>
HTTP>
DCPType>
esri_wms:GetStyles>
Request>
<Exception>
<Format>application/vnd.ogc.se_xmlFormat>
<Format>application/vnd.ogc.se_inimageFormat>
<Format>application/vnd.ogc.se_blankFormat>
<Format>text/xmlFormat>
<Format>XMLFormat>
Exception>
<Layer>
<Title>
 Layers ]]>
Title>
<CRS>CRS:84CRS>
<CRS>EPSG:4326CRS>
<CRS>EPSG:32650CRS>
<EX_GeographicBoundingBox>
<westBoundLongitude>72.000005westBoundLongitude>
<eastBoundLongitude>136.586229eastBoundLongitude>
<southBoundLatitude>5.321307southBoundLatitude>
<northBoundLatitude>53.732456northBoundLatitude>
EX_GeographicBoundingBox>
<BoundingBox CRS="CRS:84" minx="72.000005" miny="5.321307" maxx="136.586229" maxy="53.732456"/>
<BoundingBox CRS="EPSG:4326" minx="5.321307" miny="72.000005" maxx="53.732456" maxy="136.586229"/>
<BoundingBox CRS="EPSG:32650" minx="-3349539.763368" miny="699938.732971" maxx="1835172.302520" maxy="5953755.302927"/>
<Layer queryable="1">
<Name>0Name>
<Title>
 utm_wgs84 ]]>
Title>
<Abstract>
 utm_wgs84 ]]>
Abstract>
<CRS>CRS:84CRS>
<CRS>EPSG:4326CRS>
<CRS>EPSG:32650CRS>
<EX_GeographicBoundingBox>
<westBoundLongitude>72.000005westBoundLongitude>
<eastBoundLongitude>136.586229eastBoundLongitude>
<southBoundLatitude>5.321307southBoundLatitude>
<northBoundLatitude>53.732456northBoundLatitude>
EX_GeographicBoundingBox>
<BoundingBox CRS="CRS:84" minx="72.000005" miny="5.321307" maxx="136.586229" maxy="53.732456"/>
<BoundingBox CRS="EPSG:4326" minx="5.321307" miny="72.000005" maxx="53.732456" maxy="136.586229"/>
<BoundingBox CRS="EPSG:32650" minx="-3349539.763368" miny="699938.732971" maxx="1835172.302520" maxy="5953755.302927"/>
<Style>
<Name>defaultName>
<Title>0Title>
<LegendURL width="16" height="16">
<Format>image/pngFormat>
<OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://localhost:6080/arcgis/services/tttt/tt/MapServer/WmsServer?request=GetLegendGraphic%26version=1.3.0%26format=image/png%26layer=0" xlink:type="simple"/>
LegendURL>
Style>
Layer>
Layer>
Capability>
WMS_Capabilities>

3.2GetMap(获取地图)

3.2.1基本介绍
The GetMap operation requests that the server generate a map. The core parameters specify one or more layers and styles to appear on the map, a bounding box for the map extent, a target spatial reference system, and a width, height, and format for the output. The information needed to specify values for parameters such as layers, styles and srs can be obtained from the Capabilities document.

The response is a map image, or other map output artifact, depending on the format requested. GeoServer provides a wide variety of output formats, described in WMS output formats.

The standard parameters for the GetMap operation are:
OGC——WMS服务_第5张图片

3.2.2举例介绍
请求方式:http://localhost:6080/arcgis/services/tttt/tt/MapServer/WMSServer?version=1.3.0&request=getmap&layers=0&styles=default&crs=4326&bbox=110,35,120,45&width=300&height=300&format=image/png
这里需要注意的是,layers名字要写正确,crs坐标系,bbox图片范围,height图片高像素,width图片宽像素,format这个就不用多说了吧。其实填充的这些参数你都可以在上面GetCapabilities 请求结果中找到==
请求结果:
OGC——WMS服务_第6张图片

3.3GetFeatureInfo(根据地图上的像素点获取更详细的要素信息,类似Identify功能)

3.3.1基本介绍

The GetFeatureInfo operation requests the spatial and attribute data for the features at a given location on a map. It is similar to the WFS GetFeature operation, but less flexible in both input and output. Since GeoServer provides a WFS service we recommend using it instead of GetFeatureInfo whenever possible.

The one advantage of GetFeatureInfo is that the request uses an (x,y) pixel value from a returned WMS image. This is easier to use for a naive client that is not able to perform true geographic referencing.

The standard parameters for the GetFeatureInfo operation are:
OGC——WMS服务_第7张图片

3.3.2举例介绍

请求方式:http://localhost:6080/arcgis/services/tttt/tt/MapServer/WMSServer?VERSION=1.3.0&REQUEST=GetFeatureInfo&QUERY_LAYERS=0&BBOX=110,35,120,45&crs=4326&INFO_FORMAT=text/html&I=200&J=100&WIDTH=256&HEIGHT=256

这里需要注意的参数QUERY_LAYERS请求的图层,BBOX图片的范围,INFO_FORMAT返回数据格式,I图片的像素横坐标,J图片像素纵坐标,width与height同getmap函数一样。同理这里的参数都可以在GetCapabilities中查找到奥==

还有一点要注意的是version版本问题要注意对上,网上很多资料由于版本不一致导致不能使用,并不是写错了==

请求结果:

OGC——WMS服务_第8张图片

四、总结

  • 学习WMS迫在眉睫;
  • arcgis server发布WMS服务;
  • WMS中的三种操作方法介绍与举例。

 

 参考链接:

1、OGC——WMS详细介绍(arcgis server举例)

2、WMS GetMap GetCapabilities 参数详解

你可能感兴趣的:(OGC——WMS服务)