http://127.0.0.1/arcgis/services/mas/MapServer/WMSServer?version=1.1.1&request=getmap&layers=马鞍山市界:0&styles=population&SRS=EPSG:4326&bbox=-118.3,31.3,118.9,31.8&width=400&height=400&format=image/png
参数 ——
version=1.1.1 —— WMS版本号
request=getmap —— 操作动词,可以为GetCapabilities, GetMap和GetFeatureInfo等
layers=topp:states —— 请求地图所包含的图层名,可以为多层
styles=population —— 指定图层绘制的样式名
SRS=EPSG:4326 —— 指定地图的坐标投影系统代码
bbox=-125,24,-67,50 —— 请求地图的范围(The Bounding Box)
width=400 —— 地图的像素宽度
height=200 —— 地图的像素高度,宽度和高度的不同设置可能会引起返回图像的变形
format=image/png —— 返回地图图像的格式,可以为Image/gif, image/jpg, image/svg+xml等等
如果参数设置错误,将返回一个XML文件来描述错误信息。如下所示:
<ServiceExceptionReport version=”1.1.1“>
<ServiceException code=”">
WIDTH and HEIGHT incorrectly specified
</ServiceException>
</ServiceExceptionReport>
GetMap
返回一张图片
Request Parameter Required/Optional Description
REQUEST=GetMap R 请求的操作,此处为GetMap
VERSION=version R WMS版本,使用的参数为1.0.0/1.1.0/1.1.1
LAYERS=layer_list R 图层名称,多个图层使用逗号分开,读取Capabilities 文件里面<Name>的值
SRS=EPSG:id_code R 坐标系
如:SRS=EPSG:2435
BBOX=minx,miny,maxx,maxy R 返回地图范围,单位必须与定义好的坐标系相同
WIDTH=output_width R 返回图像宽度,单位:像素
HEIGHT=output_height R 返回图像高度,单位:像素
STYLES=style_list R 指定图层绘制的样式名
STYLES=&表示读取默认样式
FORMAT=output_format R 输出图片格式
image/jpeg
mage/png
and image/gif
BGCOLOR=color_value O 地图背景色
默认值为0xFFFFFF,白色
TRANSPARENT=TRUE | FALSE O 背景透明度,默认为FALSE
SLD=sld_url O URL of a styled layer descriptor file. See the WMS specification documentation for details.
EXCEPTIONS=exception_format O The format in which exceptions are reported. The default is application/vnd.ogc.se_xml. Other valid formats are application/vnd.ogc.inimage and application/vnd.ogc.se_blank.
REASPECT=TRUE | FALSE
(Vendor Specific) O Used if clients want to reaspect the BBOX. The default is based on the selection made in the WMS Connector Administrator. Reaspect is valid only with Image Services. It is not valid with ArcIMS ArcMap Image Services and is always TRUE.
SERVICENAME=service_name
(vendor specific) O 服务名称
Example 1:最少参数,访问默认WMS服务
http://<hostname>/<deploy_name>/com.esri.wms.Esrimap?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=Oceans,Countries,Cities&STYLES=&SRS=EPSG:4326&BBOX=-124,21,-66,49&WIDTH=600&HEIGHT=400&FORMAT=image/png&
·· VERSION=1.1.1: wms版本
· REQUEST=GetMap : 请求的操作
· LAYERS=Oceans,Countries,Cities :图层名·称
· STYLES= is the styles reference. This should be left empty.
· SRS=EPSG:4326:坐标·系,·4326表示WGS 1984坐标·系
· BBOX=-124,21,-66,49 :地图范围
· WIDTH=600&HEIGHT=400 :图像大小
· FORMAT=image/png:输出图片格式
真实案例:
http://172.17.14.248/wmsconnector/com.esri.wms.Esrimap?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=0,1,2,3,4&STYLES=&SRS=EPSG:4326&BBOX=-134.0380062312,16.4467786721,-58.3100735341,50.29156016&WIDTH=600&HEIGHT=400&FORMAT=image/png&
Example 2:指定服务名称
http://<hostname>/<deploy_name>/com.esri.wms.Esrimap?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=States,Cities&STYLES=&SRS=EPSG:4326&BBOX=-124,21,-66,49&WIDTH=600&HEIGHT=400&FORMAT=image/png&SERVICENAME=myService&
· SERVICENAME=myService指定服务名·称.
真实案例:
http://172.17.14.248/wmsconnector/com.esri.wms.Esrimap?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,&STYLES=&SRS=EPSG:4326&BBOX=70.365,0.901,138.1678,56.0654&WIDTH=600&HEIGHT=400&FORMAT=image/png&SERVICENAME=china&
http://<hostname>/<deploy_name>/com.esri.wms.Esrimap/myService?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=States,Cities&STYLES=&SRS=EPSG:4326&BBOX=-124,21,-66,49&WIDTH=600&HEIGHT=400&FORMAT=image/png&
· /myService必须写在”?”前面,· 区分大小写
真实案例:
http://172.17.14.248/wmsconnector/com.esri.wms.Esrimap/china?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,&STYLES=&SRS=EPSG:4326&BBOX=70.365,0.901,138.1678,56.0654&WIDTH=600&HEIGHT=400&FORMAT=image/png&
Example 3:使用可选参数
http://<hostname>/<deploy_name>/com.esri.wms.Esrimap/?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=States,Cities&STYLES=&SRS=EPSG:4326&BBOX=-124,21,-66,49&WIDTH=600&HEIGHT=400&FORMAT=image/png&SERVICENAME=myservice&
TRANSPARENT=TRUE&BGCOLOR=0xFF0000&EXCEPTIONS=application/vnd.ogc.se_blank&REASPECT=TRUE&
真实案例:
http://172.17.14.248/wmsconnector/com.esri.wms.Esrimap?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,&STYLES=&SRS=EPSG:4326&BBOX=70.365,0.901,138.1678,56.0654&WIDTH=600&HEIGHT=400&FORMAT=image/png&SERVICENAME=china&TRANSPARENT=TRUE&BGCOLOR=0xFF0000&EXCEPTIONS=application/vnd.ogc.se_blank&REASPECT=TRUE&
使用其它客户端访问WMS服务
例如:Arccatlog里面的Add WMS Server
真实案例:
http://172.17.14.248/wmsconnector/com.esri.wms.Esrimap/china?
GetCapabilities请求用于查询WMS服务的能力信息,包括支持的服务、支持的格式、空间坐标、地图列表、地图样式等。它主要的目的是使客户端在使用GetMap请求前可以对WMS服务有一个基本的了解,从而可以设置正确的参数。
GetCapabilities请求的样例如下所示:
http://127.0.0.1/arcgis/services/mas/MapServer/WMSServer?version=1.1.1&request=getcapabilities
GetCapabilities请求用于查询WMS服务的能力信息,包含的信息如下GetFeatureInfo用于查询屏幕某点的对象信息,它的样例请求如下所示:
http://127.0.0.1/arcgis/services/mas/MapServer/WMSServer?version=1.1.1&request=getfeatureinfo&SRS=EPSG:4326&bbox=118.3,31.3,118.9,31.8&width=600&height=600&INFO_FORMAT=text/html&X=200&Y=150&query_layers=0,1
注意:bbox是地图坐标(经度,维度),x,y是屏幕坐标,。query_layers层是指层ID.
此请求返回一个HTML文档来描述对象,如下所示:
Results for FeatureType ’states’:
——————————————–
the_geom = [GEOMETRY (MultiPolygon) with 153 points]
STATE_NAME = Arizona
STATE_FIPS = 04
SUB_REGION = Mtn
STATE_ABBR = AZ
LAND_KM = 294333.462
WATER_KM = 942.772
PERSONS = 3665228.0
FAMILIES = 940106.0
HOUSHOLD = 1368843.0
MALE = 1810691.0
FEMALE = 1854537.0
WORKERS = 1358263.0
DRVALONE = 1178320.0
CARPOOL = 239083.0
PUBTRANS = 32856.0
EMPLOYED = 1603896.0
UNEMPLOY = 123902.0
SERVICE = 455896.0
MANUAL = 185109.0
P_MALE = 0.494
P_FEMALE = 0.506
SAMP_POP = 468178.0
GetFeatureInfo
GetFeatureInfo用于查询屏幕某点的对象信息
Request Parameter Required/Optional Description
REQUEST=GetFeatureInfo R 请求的操作,此处为GetFeatureInfo
VERSION=version* R WMS版本,使用的参数为1.0.0/1.1.01.1.1
SRS=EPSG:id_code* R 坐标系
如:SRS=EPSG:2435
BBOX=minx,miny,maxx,maxy* R 返回地图范围,单位必须与定义好的坐标系相同
WIDTH=output_width* R 返回图像宽度,单位:像素
HEIGHT=output_height* R 返回图像高度,单位:像素
QUERY_LAYERS=layer_list R 图层名称,多个图层使用逗号分开,读取Capabilities 文件里面<Name>的值
X=pixel_column R X coordinate in pixels of feature measured from upper left corner of the map.
Y=pixel_row R Y coordinate in pixels of feature measured from upper left corner of the map.
INFO_FORMAT=output_format O 输出格式,默认为application/vnd.ogc.wms_xml
其他还可以使用text/xml, text/html, text/plain
FEATURE_COUNT=number O 每个图层的要素数量,默认为1
EXCEPTIONS=exception_format O The format in which exceptions are reported. The default and only supported value is application/vnd.ogc.se_xml.
SERVICENAME=service_name
(vendor specific) O 服务名称
说明:O可选项;R,必选项
Example 1:最少参数,访问默认WMS服务
使用最少参数,读取默认WMS服务
http://<hostname>/<deploy_name>/com.esri.wms.Esrimap?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetFeatureInfo&SRS=EPSG:4326&BBOX=-117,38,-90,49&WIDTH=600&HEIGHT=400&QUERY_LAYERS=States&X=200&Y=150&
· VERSION=1.1.1: wms版本
· REQUEST=GetFeatureInfo: 请求的操作
· SRS=EPSG:4326:坐标·系,·4326表示WGS 1984坐标·系
· BBOX=-124,21,-66,49 :地图范围
· WIDTH=600&HEIGHT=400 :图像大小
· QUERY_LAYERS=States:图层列表
· X=200&Y=150 :位置
真实案例:
http://172.17.14.248/wmsconnector/com.esri.wms.Esrimap?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetFeatureInfo&SRS=EPSG:4326&BBOX=-134.0380062312,16.4467786721,-58.3100735341,50.29156016&WIDTH=600&HEIGHT=400&QUERY_LAYERS=4,3,2,1,0&X=200&Y=150&
Example 2:指定服务名称
http://<hostname>/<deploy_name>/com.esri.wms.Esrimap?VERSION=1.1.1&REQUEST=GetFeatureInfo&SRS=EPSG:4326&BBOX=-117,38,-90,49&WIDTH=600&HEIGHT=400&QUERY_LAYERS=States&X=200&Y=150&SERVICENAME=myService&
· SERVICENAME=myService指·定服务名称
真实案例:
http://172.17.14.248/wmsconnector/com.esri.wms.Esrimap?VERSION=1.1.1&REQUEST=GetFeatureInfo&SRS=EPSG:4326&BBOX=70.365,0.901,138.1678,56.0654&WIDTH=600&HEIGHT=400&QUERY_LAYERS=0,1,2,3,4,5,6&X=300&Y=200&SERVICENAME=china&
也可以不写SERVICENAME
http://<hostname>/<deploy_name>/com.esri.wms.Esrimap/myService?VERSION=1.1.1&REQUEST=GetFeatureInfo&SRS=EPSG:4326&BBOX=-117,38,-90,49&WIDTH=600&HEIGHT=400&QUERY_LAYERS=States&X=200&Y=150&
· /myService 必须写在”?”前面,· 区分大小写
真实案例:
http://172.17.14.248/wmsconnector/com.esri.wms.Esrimap/china?VERSION=1.1.1&REQUEST=GetFeatureInfo&SRS=EPSG:4326&BBOX=70.365,0.901,138.1678,56.0654&WIDTH=600&HEIGHT=400&QUERY_LAYERS=0,1,2,3,4,5,6&X=300&Y=200&
Example 3:使用可选参数
In the following example, optional parameters are specified. This URL should be all on one line.
http://<hostname>/<deploy_name>/com.esri.wms.Esrimap?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetFeatureInfo&SRS=EPSG:4326&BBOX=-117,38,-90,49&WIDTH=600&HEIGHT=400&QUERY_LAYERS=States&X=200&Y=150&SERVICENAME=myService&
INFO_FORMAT=text/html&EXCEPTIONS=application/vnd.ogc.se_xml&FEATURE_COUNT=5&
· INFO_FORMAT=text/html 定义输出格式
· EXCEPTIONS=application/vnd.ogc.se_xml is the exceptions output format, in this case XML.
· FEATURE_COUNT=5 定义每个图层返回的要素数量
真实案例:
http://172.17.14.248/wmsconnector/com.esri.wms.Esrimap?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetFeatureInfo&SRS=EPSG:4326&BBOX=70.365,0.901,138.1678,56.0654&WIDTH=600&HEIGHT=400&QUERY_LAYERS=0,1,2,3,4,5,6&X=300&Y=200&SERVICENAME=china&INFO_FORMAT=text/html&EXCEPTIONS=application/vnd.ogc.se_xml&FEATURE_COUNT=5&