前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >跟牛老师一起学WEBGIS——WEBGIS基础(WMS服务)

跟牛老师一起学WEBGIS——WEBGIS基础(WMS服务)

作者头像
lzugis
发布2020-08-31 11:01:58
1.1K0
发布2020-08-31 11:01:58
举报
文章被收录于专栏:跟牛老师一起学WEBGIS

2.2 WMS服务

WMS是Web Map Service(网络地图服务)的缩写,是开放地理空间联盟 (OGC) 定义提供和使用动态地图时需遵守的国际规范。到目前为止,已发布了四个版本的 WMS 规范:1.0.0、1.1.0、1.1.1 和1.3.0(最新)。

它是利用具有地理空间位置信息的数据制作地图,其中将地图定义为地理数据的可视化表现,能够根据用户的请求,返回相应的地图,包括PNG、GIF、JPEG等栅格形式,或者SVG或者WEB CGM等矢量形式。WMS支持HTTP协议,所支持的操作是由URL决定的。WMS提供如下操作:

请求服务的元数据 (GetCapabilities)
1.请求参数

参数名称

必选参数

默认值

备注

SERVICE

Y

WMS

参数值不可改

REQUEST

Y

getCapabilities

参数值不可改

VERSION

N

1.3.0

2.结果说明
代码语言:javascript
复制
<WMS_Capabilities>
  <Service>
    <!-- -->
  </Service>
  <Capability>
    <!-- -->
  </Capability>
</WMS_Capabilities>

service节点内容如下:

代码语言:javascript
复制
<Service>
  <Name>WMS</Name>
  <Title>GeoServer Web Map Service</Title>
  <Abstract>A compliant implementation of WMS plus most of the SLD extension (dynamic styling). Can also generate PDF, SVG, KML, GeoRSS</Abstract>
  <KeywordList>
    <Keyword>WFS</Keyword>
    <Keyword>WMS</Keyword>
    <Keyword>GEOSERVER</Keyword>
  </KeywordList>
  <OnlineResource xlink:type="simple" xlink:href="http://geoserver.org"/>
  <ContactInformation>
    <ContactPersonPrimary>
      <ContactPerson>Claudius Ptolomaeus</ContactPerson>
      <ContactOrganization>The Ancient Geographers</ContactOrganization>
    </ContactPersonPrimary>
    <ContactPosition>Chief Geographer</ContactPosition>
    <ContactAddress>
      <AddressType>Work</AddressType>
      <Address/>
      <City>Alexandria</City>
      <StateOrProvince/>
      <PostCode/>
      <Country>Egypt</Country>
    </ContactAddress>
    <ContactVoiceTelephone/>
    <ContactFacsimileTelephone/>
    <ContactElectronicMailAddress>claudius.ptolomaeus@gmail.com</ContactElectronicMailAddress>
  </ContactInformation>
  <Fees>NONE</Fees>
  <AccessConstraints>NONE</AccessConstraints>
</Service>

Capability节点内容如下:

代码语言:javascript
复制
<Capability>
  <Request>
    <GetCapabilities>
      <Format>text/xml</Format>
      <DCPType>
        <HTTP>
          <Get>
            <OnlineResource xlink:type="simple" xlink:href="http://localhost:8086/geoserver/easygis/ows?SERVICE=WMS&amp;"/>
          </Get>
          <Post>
            <OnlineResource xlink:type="simple" xlink:href="http://localhost:8086/geoserver/easygis/ows?SERVICE=WMS&amp;"/>
          </Post>
        </HTTP>
      </DCPType>
    </GetCapabilities>
    <GetMap>
      <Format>image/png</Format>
      <Format>application/atom+xml</Format>
      <Format>application/json;type=geojson</Format>
      <Format>application/json;type=topojson</Format>
      <Format>application/json;type=utfgrid</Format>
      <Format>application/pdf</Format>
      <Format>application/rss+xml</Format>
      <Format>application/vnd.google-earth.kml+xml</Format>
      <Format>application/vnd.google-earth.kml+xml;mode=networklink</Format>
      <Format>application/vnd.google-earth.kmz</Format>
      <Format>application/x-protobuf;type=mapbox-vector</Format>
      <Format>image/geotiff</Format>
      <Format>image/geotiff8</Format>
      <Format>image/gif</Format>
      <Format>image/jpeg</Format>
      <Format>image/png; mode=8bit</Format>
      <Format>image/svg+xml</Format>
      <Format>image/tiff</Format>
      <Format>image/tiff8</Format>
      <Format>image/vnd.jpeg-png</Format>
      <Format>text/html; subtype=openlayers</Format>
      <DCPType>
        <HTTP>
          <Get>
            <OnlineResource xlink:type="simple" xlink:href="http://localhost:8086/geoserver/easygis/ows?SERVICE=WMS&amp;"/>
          </Get>
        </HTTP>
      </DCPType>
    </GetMap>
    <GetFeatureInfo>
      <Format>text/plain</Format>
      <Format>application/vnd.ogc.gml</Format>
      <Format>text/xml</Format>
      <Format>application/vnd.ogc.gml/3.1.1</Format>
      <Format>text/xml; subtype=gml/3.1.1</Format>
      <Format>text/html</Format>
      <Format>application/json</Format>
      <DCPType>
        <HTTP>
          <Get>
            <OnlineResource xlink:type="simple" xlink:href="http://localhost:8086/geoserver/easygis/ows?SERVICE=WMS&amp;"/>
          </Get>
        </HTTP>
      </DCPType>
    </GetFeatureInfo>
  </Request>
  <Exception>
    <Format>XML</Format>
    <Format>INIMAGE</Format>
    <Format>BLANK</Format>
    <Format>JSON</Format>
  </Exception>
  <Layer>
    <Title>GeoServer Web Map Service</Title>
    <Abstract>A compliant implementation of WMS plus most of the SLD extension (dynamic styling). Can also generate PDF, SVG, KML, GeoRSS</Abstract>
    <!--All supported EPSG projections:-->
    <CRS>AUTO:4326</CRS>
    <CRS>AUTO:3857</CRS>
    <EX_GeographicBoundingBox>
      <westBoundLongitude>-180.0</westBoundLongitude>
      <eastBoundLongitude>180.00000033527613</eastBoundLongitude>
      <southBoundLatitude>-90.00000000000003</southBoundLatitude>
      <northBoundLatitude>83.6236001622701</northBoundLatitude>
    </EX_GeographicBoundingBox>
    <BoundingBox CRS="CRS:84" minx="-180.0" miny="-90.00000000000003" maxx="180.00000033527613" maxy="83.6236001622701"/>
    <Layer queryable="1" opaque="0">
      <Name>layer_china_boundry</Name>
      <Title>layer_china_boundry</Title>
      <Abstract/>
      <KeywordList>
        <Keyword>features</Keyword>
        <Keyword>layer_china_boundry</Keyword>
      </KeywordList>
      <CRS>EPSG:4326</CRS>
      <CRS>CRS:84</CRS>
      <EX_GeographicBoundingBox>
        <westBoundLongitude>73.44696044921875</westBoundLongitude>
        <eastBoundLongitude>135.08583068847656</eastBoundLongitude>
        <southBoundLatitude>3.408477306365967</southBoundLatitude>
        <northBoundLatitude>53.557926177978516</northBoundLatitude>
      </EX_GeographicBoundingBox>
      <BoundingBox CRS="CRS:84" minx="73.44696044921875" miny="3.408477306365967" maxx="135.08583068847656" maxy="53.557926177978516"/>
      <BoundingBox CRS="EPSG:4326" minx="3.408477306365967" miny="73.44696044921875" maxx="53.557926177978516" maxy="135.08583068847656"/>
      <Style>
        <Name>line</Name>
        <Title>Default Line</Title>
        <Abstract>A sample style that draws a line</Abstract>
        <LegendURL width="20" height="20">
          <Format>image/png</Format>
          <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://localhost:8086/geoserver/easygis/ows?service=WMS&amp;request=GetLegendGraphic&amp;format=image%2Fpng&amp;width=20&amp;height=20&amp;layer=layer_china_boundry"/>
        </LegendURL>
      </Style>
    </Layer>
  </Layer>
</Capability>
3.请求示例

http://localhost:8086/geoserver/easygis/wms?service=WMS&request=getCapabilities

请求地图影像 (GetMap)
1.请求参数

参数名称

必选参数

默认值

备注

SERVICE

Y

WMS

参数值不可改

REQUEST

Y

GetMap

参数值不可改

VERSION

N

1.3.0

FORMAT

N

image/png

TRANSPARENT

N

true

LAYERS

Y

SRS

Y

EPSG:4326

WIDTH

Y

HEIGHT

Y

BBOX

Y

xmin,ymin,xmax,ymax

STYLES

N

CQL_FILTER

N

2.结果说明
请求结果
请求结果
3.请求示例

http://localhost:8086/geoserver/easygis/wms?SERVICE=WMS&REQUEST=GetMap&FORMAT=image/png&TRANSPARENT=true&LAYERS=easygis:layer_china_province&SRS=EPSG:4326&WIDTH=768&HEIGHT=589&BBOX=70.48828125,8.1298828125,137.98828125,59.89746&VERSION=1.1.1

请求关于地图要素的信息(GetFeatureInfo
1.请求参数

参数名称

必选参数

默认值

备注

SERVICE

Y

WMS

参数值不可改

REQUEST

Y

GetFeatureInfo

参数值不可改

VERSION

N

1.3.0

SRS

Y

EPSG:4326

WIDTH

Y

HEIGHT

Y

BBOX

Y

xmin,ymin,xmax,ymax

CQL_FILTER

N

INFO_FORMAT

Y

text/html

FEATURE_COUNT

Y

50

X

Y

50

Y

Y

50

2.结果说明
返回结果
返回结果
3.请求示例

http://localhost:8086/geoserver/easygis/wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetFeatureInfo&FORMAT=image/png&TRANSPARENT=true&QUERY_LAYERS=easygis:layer_china_province&STYLES&LAYERS=easygis:layer_china_province&INFO_FORMAT=text/html&FEATURE_COUNT=50&X=50&Y=50&SRS=EPSG:4326&WIDTH=101&HEIGHT=101&BBOX=88.6376953125,25.224609375000007,97.5146484375,34.10156250000001

请求用户自定义样式 (GetStyles)
1.请求参数

参数名称

必选参数

默认值

备注

REQUEST

Y

GetStyles

参数值不可改

VERSION

N

1.3.0

LAYER

Y

2.请求示例

http://localhost:8086/geoserver/jtmet/wms?request=GetStyles&layers=layer_china_province&VERSION=1.3.0

请求图例符号 (GetLegendGraphic)
1.请求参数

参数名称

必选参数

默认值

备注

REQUEST

Y

GetLegendGraphic

参数值不可改

VERSION

N

1.3.0

LAYER

Y

FORMAT

N

image/png

2.结果说明
请求结果
请求结果
3.请求示例

`http://localhost:8086/geoserver/easygis/wms?request=GetLegendGraphic&VERSION=1.3.0&layer=easygis:base_capital&FORMAT=image/png

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2020/08/29 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 2.2 WMS服务
    • 请求服务的元数据 (GetCapabilities)
      • 1.请求参数
      • 2.结果说明
      • 3.请求示例
    • 请求地图影像 (GetMap)
      • 1.请求参数
      • 2.结果说明
      • 3.请求示例
    • 请求关于地图要素的信息(GetFeatureInfo)
      • 1.请求参数
      • 2.结果说明
      • 3.请求示例
    • 请求用户自定义样式 (GetStyles)
      • 1.请求参数
      • 2.请求示例
    • 请求图例符号 (GetLegendGraphic)
      • 1.请求参数
      • 2.结果说明
      • 3.请求示例
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档