注:arcgis server 版本为9.3,其他版本未试
arcgis server 中发布wms、wfs等很简单,只要在发布的mapService中那个功能中勾住相应的选项就完了,但是发布之后使用的时候会遇到一些问题,目前本人遇到以下问题,当时找了半天才找到原因,现在公布之,节约全人类的时间
========About WMS==========
WMS服务中图层名的变化
WMS服务发布后,请求时有个参数LAYERS,这个参数的值就是图层的名字,但是server93发布之后的图层名并不是mxd文档中所看到的图层名,而是被改过了,成了0、1、2、3这样的数字,所以你在访问的时候LAYERS参数要注意了。
查看这个0123可以在catalog里建一个wms服务器,然后就能看到图层名对应的数字了,这个改为数字大概是因为请求的图层多了会超过http的get请求提交数据所规定的256个字符吧
关于如何修改这个0123,我还不知道
========About WFS==========
【1】.点坐标表达的顺序问题(x,y)还是(y,x)
如果这里不注意的话可能出现访问成功但是得不到地理要素的问题
可以通过设置配置文件来修改,帮助文档中相关部分,看看就明白了:
Controlling the axis order
Features returned in some geographic coordinate systems (for example, WGS 84) have an axis order of lat, long (y,x) by default. This is in compliance with the WFS 1.1 specification. For example, a point may be returned from a getfeature request with its coordinates specified as follows:
<gml:Point> <gml:pos>48.4922165520043 -122.630685732366</gml:pos> </gml:Point>Some WFS clients expect the coordinates to be returned with an axis order of long, lat (x,y). To work with these clients, you can set the axis order for the service to be long, lat. The following describes how to set the property:
1.Log on to the machine running ArcGIS server as an administrator.
2.Shut down ArcGIS Server.
3.Go to the location of the service configuration files. For example, if ArcGIS Server is installed in c:/arcgis, go to c:/arcgis/server/user/cfg.
4.Open the configuration file for your service (for example, myservice.cfg) in a text editor.
5.In the WFS section, add the following to the properties:
<AxisOrderWFS11>longlat</AxisOrderWFS11> For example:
<Extension>
<TypeName>WFSServer</TypeName>
<Enabled>true</Enabled>
<Properties>
<AxisOrderWFS11>longlat</AxisOrderWFS11>
<CustomGetCapabilities>false</CustomGetCapabilities>
<EnableTransactions>false</EnableTransactions>
<Name>wfs_WFSTest_ras</Name>
<OnlineResource>http://bobmk/arcgis/services/wfs/WFSTest_ras/MapServer/WFSServer</OnlineResource>
<AppSchemaURI>http://bobmk/arcgis/services/wfs/WFSTest_ras/MapServer/WFSServer</AppSchemaURI>
<AppSchemaPrefix>wfs_WFSTest_ras</AppSchemaPrefix>
</Properties>
<Info>
<WebEnabled>true</WebEnabled>
</Info>
</Extension>
6.Start ArcGIS Server.
Features with geographic coordinates requested from the service are now returned with a long, lat axis order.
Note that the axis order property only applies to features with geographic coordinates. Features with projected coordinates are always returned with an x, y axis order.
【2】.wfs服务返回的gml的posList节点的问题
server93返回的gml版本为v3,其中,表达线和面对象的时候,点的坐标列表是这个节点:
<gml:posList >。。。</gml:posList>
这里面是点坐标的列表,server93返回的是这样的:
<gml:posList >-86.336181640625 34.7922973632813 -82.8035888671875 33.6369018554688 -84.4921264648438 30.926513671875 -87.5136108398438 33.6591186523438 -87.2025756835938 34.4144897460938 -86.336181640625 34.7922973632813</gml:posList>
但是这些点到底是2维还是3维的怎么知道呢?
应该是<gml:posList dimension=2>
这里有个dimension属性,但是esri没有给出,所以在客户端解析gml的时候如果用到了这个属性就麻烦了,开源的还好,改一下,默认为2就行了。不知道OGC标准里有没有说必须要指定dimension这个属性
【3】wfs服务的属性查询问题,这个问题不是ags的问题,是wfs的问题
如果你是在用get的方式向wfs服务器传递参数,那么,属性查询的时候要注意了,filter这个参数后面带着一串xml格式的字符串,但是xml字符串中的filter节点要加上命名空间,否则打死也没效果,而且如果有bbox参数的话,会和filter参数冲突,必须把bbox参数转化到filter参数的xml字符串中
filter参数内容的一个例子:
然后把这一大长串字符串加到filter参数中就行了,比如
http://localhost/WFS?typename=mylayername&SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&SRS=EPSG:4326&filter=上面那一堆字符串
那一堆的字符串确实很难看,太长了,没办法,用get请求 就得忍了,忍不了用soap请求好了
over