码迷,mamicode.com
首页 > 其他好文 > 详细

OGC——WMS服务

时间:2020-02-16 01:10:53      阅读:101      评论:0      收藏:0      [点我收藏+]

标签:extension   arc   source   input   about   方式   param   span   mile   

一、引言

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

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

 

二、WMS服务发布

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

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

技术图片    技术图片

 

三、WMS服务中的操作

 
WMS提供了以下的操作
 

WMS requests can perform the following operations:

技术图片

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:
技术图片

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>
<![CDATA[ WMS ]]>
</Name>
<Title>
<![CDATA[ tttt_tt ]]>
</Title>
<Abstract>WMS</Abstract>
<KeywordList>
<Keyword>
<![CDATA[ ]]>
</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>
<![CDATA[ ]]>
</ContactPerson>
<ContactOrganization>
<![CDATA[ ]]>
</ContactOrganization>
</ContactPersonPrimary>
<ContactPosition>
<![CDATA[ ]]>
</ContactPosition>
<ContactAddress>
<AddressType>
<![CDATA[ ]]>
</AddressType>
<Address>
<![CDATA[ ]]>
</Address>
<City>
<![CDATA[ ]]>
</City>
<StateOrProvince>
<![CDATA[ ]]>
</StateOrProvince>
<PostCode>
<![CDATA[ ]]>
</PostCode>
<Country>
<![CDATA[ ]]>
</Country>
</ContactAddress>
<ContactVoiceTelephone>
<![CDATA[ ]]>
</ContactVoiceTelephone>
<ContactFacsimileTelephone>
<![CDATA[ ]]>
</ContactFacsimileTelephone>
<ContactElectronicMailAddress>
<![CDATA[ ]]>
</ContactElectronicMailAddress>
</ContactInformation>
<Fees>
<![CDATA[ ]]>
</Fees>
<AccessConstraints>
<![CDATA[ ]]>
</AccessConstraints>
<MaxWidth>4096</MaxWidth>
<MaxHeight>4096</MaxHeight>
</Service>
<Capability>
<Request>
<GetCapabilities>
<Format>application/vnd.ogc.wms_xml</Format>
<Format>text/xml</Format>
<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/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 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_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 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+xml</Format>
<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_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>
<![CDATA[ Layers ]]>
</Title>
<CRS>CRS:84</CRS>
<CRS>EPSG:4326</CRS>
<CRS>EPSG:32650</CRS>
<EX_GeographicBoundingBox>
<westBoundLongitude>72.000005</westBoundLongitude>
<eastBoundLongitude>136.586229</eastBoundLongitude>
<southBoundLatitude>5.321307</southBoundLatitude>
<northBoundLatitude>53.732456</northBoundLatitude>
</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>0</Name>
<Title>
<![CDATA[ utm_wgs84 ]]>
</Title>
<Abstract>
<![CDATA[ utm_wgs84 ]]>
</Abstract>
<CRS>CRS:84</CRS>
<CRS>EPSG:4326</CRS>
<CRS>EPSG:32650</CRS>
<EX_GeographicBoundingBox>
<westBoundLongitude>72.000005</westBoundLongitude>
<eastBoundLongitude>136.586229</eastBoundLongitude>
<southBoundLatitude>5.321307</southBoundLatitude>
<northBoundLatitude>53.732456</northBoundLatitude>
</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>default</Name>
<Title>0</Title>
<LegendURL width="16" height="16">
<Format>image/png</Format>
<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:
技术图片

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 请求结果中找到==
请求结果:
技术图片

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:
技术图片

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版本问题要注意对上,网上很多资料由于版本不一致导致不能使用,并不是写错了==

请求结果:

技术图片

四、总结

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

 

 参考链接:

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

2、WMS GetMap GetCapabilities 参数详解

OGC——WMS服务

标签:extension   arc   source   input   about   方式   param   span   mile   

原文地址:https://www.cnblogs.com/rainbow70626/p/12315506.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!