OGC——WMS服务

一、引言

一直用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 参数详解

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

时间: 2024-11-06 11:35:19

OGC——WMS服务的相关文章

World Wind Java开发之十三——加载Geoserver发布的WMS服务(转)

这篇是转载的平常心博客,原地址见:http://www.v5cn.cn/?p=171 1.WMSTiledImageLayer类说明 一个WMSTiledImageLayer类对象只能对应一个WMS发布的服务图层,使用WMS服务时需要使用到WMS元数据描述类WMSCapabilities对象,我们使用WMSCapabilites类的静态方法retrieve来获得它的对象.WMSCapabilites对象可以包含WMS服务中所以的图层和图层样式,我们通过把需要显示的图层名称保存到AVList对象中

SkylineGlobe SFS发布的WFS和WMS服务测试

SkylineGlobe SFS发布的WFS服务:http://localhost/SFS/streamer.ashx?service=wfs&request=GetCapabilities&Username=&Password= <?xml version="1.0" encoding="UTF-8"?> <wfs:WFS_Capabilities xmlns:ows="http://www.opengis.ne

Geoserver基本使用、WMS服务发布与OpenLayers测试

1.Geoserver与OpenLayers的下载 Geoserver:http://geoserver.org/ OpenLayers:http://openlayers.org/ 2.安装部署Geoserver 环境:jdk 1.7,geoserver-2.5 配置:修改geoserver-2.5/ect/jetty.xml 的端口为8089,避免端口冲突. <Call name="addConnector"> <Arg> <New class=&qu

中科燕园GIS外包讲解1 -----OpenLayers调用WMS服务

OpenLayers调用WMS服务 OpenLayers: OpenLayers是一个开源的js框架,用于在您的浏览器中实现地图浏览的效果和基本的zoom,pan等功能.OpenLayers支持的地图来源包括了WMS,GoogleMap,KaMap,MSVirtualEarth等等,您也可以用简单的图片作为源,在这一方面OPenLayers提供了非常多的选择. WMS服务:     1 OGC组织及其开放性规范 为了实现异构的地理空间信息及GIS处理功能的互操作的集成,OGC(Open GIS

(十九)ArcGIS JS 加载WMS服务(超图示例)

前言 在工作中,需要在ArcGIS API for JavaScript中加载超图服务,因为超图的rest服务只可以用于Leaflet .openlayers3 (with MVT) .MapboxGL .Tianditu.com,在使用ArcGIS API是无法加载超图的rest服务的(我认知的).    在超图的superMap iServer中可以发布符合OGC规则的WMS服务,这时,我们可以通ArcGIS API加载WMS服务的形式加载超图服务. 加载WMS服务要点 visibleLay

使用GeoServer发布shp数据为WMS服务和WFS服务(图文教程)

使用GeoServer发布shp数据为WMS服务和WFS服务 使用GeoServer发布shp数据为WMS服务和WFS服务 1安装GeoServer 2使用GeoServer上传数据 3使用GeoServer发布数据为WMS和WFS 看完本教程,你将学会安装Geoserver,然后将shp图发布为WMS和WFS服务,在后续文章中,将讲到使用GeoServer发布PostGIS空间数据库中的数据,以及在Mapbox,Openlayers中如何调用WFS和WMS服务. 1安装GeoServer 我安

Geoserver发布WMS服务出错分析

使用Geoserver发布一个空间表,在图层预览的过程中没有任何问题,但是当我根据这个空间表传创建视图再发布wms服务,访问时就会报错,错误信息如下: Caused by: java.sql.SQLException: ORA-29902: 执行 ODCIIndexStart() 例行程序中出 错 ORA-13208: 对运算符 [window SRID does not match layer SRID] 求值时出现内部错误 ORA-06512: 在 "MDSYS.SDO_INDEX_METH

Arcgis for Js之加载wms服务

概述:本节讲述Arcgis for Js加载ArcgisServer和GeoServer发布的wms服务. 1.定义resourceInfo var resourceInfo = { extent: new Extent(-126.40869140625,31.025390625,-109.66552734375,41.5283203125,{wkid: 4326}), layerInfos: [], version : '1.1.1' }; 2.加载ArcgisServer的wms var a

skyline加载arcgis发布的wms服务

function AddWMSLayer(LayerName) {var _WMSUrl =“http://10.0.4.141:6080/arcgis/services/poss1/MapServer/WmsServer”;var layerGroup = sg.ProjectTree.FindItem(“Layers”);if (layerGroup == “”){layerGroup = sg.ProjectTree.CreateGroup(“Layers”, “”);} if (Laye