WMS详细介绍、WMS查询(arcgis server举例 )

转载原文链接:https://blog.csdn.net/xcymorningsun/article/details/60575543

一、引言

        一直用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:
Operation     Description
Exceptions     If an exception occur
GetCapabilities     Retrieves metadata about the service, including supported operations and parameters, and a list of the available layers
GetMap     Retrieves a map image for a specified area and content
GetFeatureInfo(optional)     Retrieves the underlying data, including geometry and attribute values, for a pixel location on a map
DescribeLayer(optional)     Indicates the WFS or WCS to retrieve additional information about the layer.
GetLegendGraphic(optional)

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:
Parameter     Required?     Description
service     Yes     Service name. Value is WMS.
version     Yes     Service version. Value is one of 1.0.0, 1.1.0, 1.1.1, 1.3.
request     Yes     Operation name. Value is GetCapabilities.

3.1.2举例介绍

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

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

请求结果:

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

   
   
   
   
   

    <br>     <![CDATA[ tttt_tt ]]><br>    
    WMS
   
   
   
   

   

   
   
   
   
   
   

   
   
   

   

   
   
   

   
   
   
   

   


   
   

   
   
   

   
   
   

   
   
   

   
   
   

   
   
   
   

   
   
   

   
   
   

   
   
   
   

   
   
   

    4096
    4096
   
   
   
   
    application/vnd.ogc.wms_xml
    text/xml
   
   
   
   
   

   

   

   

   
    image/bmp
    image/jpeg
    image/tiff
    image/png
    image/png8
    image/png24
    image/png32
    image/gif
    image/svg+xml
   
   
   
   
   

   

   

   

   
    application/vnd.esri.wms_raw_xml
    application/vnd.esri.wms_featureinfo_xml
    application/vnd.ogc.wms_xml
    text/xml
    text/html
    text/plain
   
   
   
   
   

   

   

   

   
    application/vnd.ogc.sld+xml
   
   
   
   
   

   

   

   

   

   
    application/vnd.ogc.se_xml
    application/vnd.ogc.se_inimage
    application/vnd.ogc.se_blank
    text/xml
    XML
   

   
    <br>     <![CDATA[ Layers ]]><br>    
    CRS:84
    EPSG:4326
    EPSG:32650
   
    72.000005
    136.586229
    5.321307
    53.732456
   

   
   
   
   
    0
    <br>     <![CDATA[ utm_wgs84 ]]><br>    
   
   
   

    CRS:84
    EPSG:4326
    EPSG:32650
   
    72.000005
    136.586229
    5.321307
    53.732456
   

   
   
   
   
   

   

   

   


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:
Parameter     Required?     Description
service     Yes     Service name. Value is WMS.
version     Yes     Service version. Value is one of 1.0.0, 1.1.0, 1.1.1, 1.3.
request     Yes     Operation name. Value is GetMap.
layers     Yes     Layers to display on map. Value is a comma-separated list of layer names.
styles     Yes     Styles in which layers are to be rendered. Value is a comma-separated list of style names, or empty if default styling is required. Style names may be empty in the list, to use default layer styling.
srs or crs     Yes     Spatial Reference System for map output. Value is in form EPSG:nnn.crs is the parameter key used in WMS 1.3.0.
bbox     Yes     Bounding box for map extent. Value is minx,miny,maxx,maxy in units of the SRS.
width     Yes     Width of map output, in pixels.
height     Yes     Height of map output, in pixels.
format     Yes     Format for the map output. See WMS output formats for supported values.
transparent     No     Whether the map background should be transparent. Values are trueor false. Default is false
bgcolor     No     Background color for the map image. Value is in the form RRGGBB. Default is FFFFFF (white).
exceptions     No     Format in which to report exceptions. Default value is application/vnd.ogc.se_xml.
time     No     Time value or range for map data. See Time Support in GeoServer WMS for more information.
sld     No     A URL referencing a StyledLayerDescriptor XML file which controls or enhances map layers and styling
sld_body     No     A URL-encoded StyledLayerDescriptor XML document which controls or enhances map layers and styling

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:
Parameter     Required?     Description
service     Yes     Service name. Value is WMS.
version     Yes     Service version. Value is one of 1.0.0, 1.1.0, 1.1.1, 1.3.
request     Yes     Operation name. Value is GetFeatureInfo.
layers     Yes     See GetMap
styles     Yes     See GetMap
srs or crs     Yes     See GetMap
bbox     Yes     See GetMap
width     Yes     See GetMap
height     Yes     See GetMap
query_layers     Yes     Comma-separated list of one or more layers to query.
info_format     No     Format for the feature information response. See below for values.
feature_count     No     Maximum number of features to return. Default is 1.
x or i     Yes     X ordinate of query point on map, in pixels. 0 is left side. i is the parameter key used in WMS 1.3.0.
y or j     Yes     Y ordinate of query point on map, in pixels. 0 is the top. j is the parameter key used in WMS 1.3.0.
exceptions     No     Format in which to report exceptions. The default value is application/vnd.ogc.se_xml.

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中的三种操作方法介绍与举例;

 

你可能感兴趣的:(OGC,javascript)