示例

Supermap iServer WPS1.0.0 服务封装了 iServer 自带的一系列分析功能(请参考WPS 概述)。用户可通过 Supermap iServer 自带的 WPS 服务执行这些分析操作,得到分析后的结果。

本示例对 WPS 服务的 Execute 操作支持的分析功能,进行 Execute 操作,执行 POST 请求,如下所示:

  1. 叠加分析功能 Clip

对 World.Countries.188 和 World.Ocean.1 两个相交面做裁剪分析,POST 请求地址:http://localhost:8090/iserver/services/spatialanalyst-changchun/wps100 请求体如下:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<wps:Execute service="WPS" version="1.0.0"

xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns:ows="http://www.opengis.net/ows/1.1"

xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:schemaLocation="http://www.opengis.net/wps/1.0.0

../wpsExecute_request.xsd">

<ows:Identifier>Clip</ows:Identifier>

<wps:DataInputs>

  <wps:Input>

    <ows:Identifier>sourceGeometry</ows:Identifier>

    <ows:Title>sourceGeometry</ows:Title>

    <wps:Reference

xlink:href="http://localhost:8090/iserver/services/data-world/wfs100?SERVICE=WFS&amp;VERSION=1.0.0&amp;REQUEST=GetFeature&amp;TYPENAME=World:Countries&amp;FEATUREID=World.Countries.188&amp;MAXFEATURES=1" />

  </wps:Input>

  <wps:Input>

    <ows:Identifier>operatePolygon</ows:Identifier>

    <ows:Title>operatePolygon</ows:Title>

    <wps:Reference

xlink:href="http://localhost:8090/iserver/services/data-world/wfs100?SERVICE=WFS&amp;VERSION=1.0.0&amp;REQUEST=GetFeature&amp;TYPENAME=World:Ocean&amp;FEATUREID=World.Ocean.1&amp;MAXFEATURES=1" />

  </wps:Input>

  <wps:Input>

    <ows:Identifier>outputformat</ows:Identifier>

    <ows:Title>format.</ows:Title>

    <wps:Data>

      <wps:LiteralData>gml212</wps:LiteralData>

    </wps:Data>

  </wps:Input>

</wps:DataInputs>

<wps:ResponseForm>

  <wps:ResponseDocument storeExecuteResponse="true">

  <wps:Output asReference="true">

    <ows:Identifier>ClippedPolygon</ows:Identifier>

    <ows:Title>Clip from polygon.</ows:Title>

    <ows:Abstract>Clip polygon by other polygon. Accepts the polygon as

GML and provides GML output for the clip feature.

    </ows:Abstract>

  </wps:Output>

  </wps:ResponseDocument>

</wps:ResponseForm>

</wps:Execute>

 响应结果如下:

  1. 表面分析功能 ExtractIsoline

对点数据集 Company@Changchun 进行提取等值线操作,POST 地址:http://localhost:8090/iserver/services/spatialanalyst-changchun/wps100 请求体为:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<wps:Execute service="WPS" version="1.0.0"

xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns:ows="http://www.opengis.net/ows/1.1"

xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:schemaLocation="http://www.opengis.net/wps/1.0.0

../wpsExecute_request.xsd">

<ows:Identifier>ExtractIsoline</ows:Identifier>

<wps:DataInputs>

  <wps:Input>

    <ows:Identifier>pointDataset</ows:Identifier>     

    <ows:Title>pointDataset</ows:Title>     

    <wps:Data>     

      <wps:LiteralData>Company@Changchun</wps:LiteralData>     

    </wps:Data>     

  </wps:Input>     

  <wps:Input>     

    <ows:Identifier>zValueField</ows:Identifier>     

    <ows:Title>zValueField.</ows:Title>     

    <wps:Data>     

      <wps:LiteralData>SMID</wps:LiteralData>     

    </wps:Data>     

  </wps:Input>    

  <wps:Input>     

    <ows:Identifier>Resolution</ows:Identifier>     

    <ows:Title>Distance which people will walk to get to a playground.

    </ows:Title>     

    <wps:Data>     

      <wps:LiteralData>20</wps:LiteralData>     

    </wps:Data>     

  </wps:Input>            

  <wps:Input>     

    <ows:Identifier>Interval</ows:Identifier>     

    <ows:Title>Interval.</ows:Title>     

    <wps:Data>     

      <wps:LiteralData>50</wps:LiteralData>     

    </wps:Data>    

  </wps:Input>    

  <wps:Input>     

    <ows:Identifier>ResampleTolerance</ows:Identifier>     

    <ows:Title>ResampleTolerance.</ows:Title>     

    <wps:Data>     

      <wps:LiteralData>0.5</wps:LiteralData>     

    </wps:Data>    

  </wps:Input>    

  <wps:Input>     

    <ows:Identifier>SmoothMethod</ows:Identifier>     

    <ows:Title>SmoothMethod.</ows:Title>     

    <wps:Data>     

      <wps:LiteralData>POLISH</wps:LiteralData>     

    </wps:Data>    

  </wps:Input>    

  <wps:Input>     

    <ows:Identifier>Smoothness</ows:Identifier>     

    <ows:Title>Smoothness.</ows:Title>     

    <wps:Data>     

      <wps:LiteralData>3</wps:LiteralData>     

    </wps:Data>    

  </wps:Input>    

  <wps:Input>     

    <ows:Identifier>TerrainInterpolateType</ows:Identifier>     

    <ows:Title>TerrainInterpolateType.</ows:Title>     

    <wps:Data>     

      <wps:LiteralData>IDW</wps:LiteralData>     

    </wps:Data>    

  </wps:Input>    

  <wps:Input>   

    <ows:Identifier>outputformat</ows:Identifier>   

    <ows:Title>format.</ows:Title>   

    <wps:Data>   

      <wps:LiteralData>gml212</wps:LiteralData>  

    </wps:Data>

  </wps:Input>  

</wps:DataInputs>    

<wps:ResponseForm>     

  <wps:ResponseDocument storeExecuteResponse="true">     

    <wps:Output asReference="false">     

      <ows:Identifier>ExtractedIsoregion</ows:Identifier>     

     <ows:Title>ExtractedIsoregion.</ows:Title>     

     <ows:Abstract>ExtractedIsoregion.</ows:Abstract>     

  </wps:Output>    

  </wps:ResponseDocument>   

</wps:ResponseForm>

</wps:Execute>

响应结果如下:

      

  1. 交通换乘分析 StopListByKeyWord

通过关键字”长春“获取站点信息,对 http://localhost:8090/iserver/services/traffictransferanalyst-sample/wps100 执行 POST 请求,

请求体为:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<wps:Execute service="WPS" version="1.0.0"

xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns:ows="http://www.opengis.net/ows/1.1"

xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:schemaLocation="http://www.opengis.net/wps/1.0.0../wpsExecute_request.xsd">   

<ows:Identifier>StopListByKeyWord</ows:Identifier>   

<wps:DataInputs>     

  <wps:Input>     

    <ows:Identifier>keyWord</ows:Identifier>     

    <ows:Title></ows:Title>     

    <wps:Data>     

      <wps:LiteralData>%e9%95%bf%e6%98%a5</wps:LiteralData>     

    </wps:Data>     

  </wps:Input>     

  <wps:Input>     

    <ows:Identifier>returnPosition</ows:Identifier>     

    <ows:Title></ows:Title>     

    <wps:Data>     

      <wps:LiteralData>true</wps:LiteralData>     

    </wps:Data>     

  </wps:Input>   

  </wps:DataInputs>    

<wps:ResponseForm>     

  <wps:ResponseDocument storeExecuteResponse="true">     

    <wps:Output asReference="false">     

      <ows:Identifier>StopListByKeyWord</ows:Identifier>     

      <ows:Title>StopListByKeyWord.</ows:Title>     

      <ows:Abstract>StopListByKeyWord.</ows:Abstract>     

    </wps:Output>    

  </wps:ResponseDocument>   

</wps:ResponseForm>

</wps:Execute>

该”%e9%95%bf%e6%98%a5“是关键字”长春“通过 URL 编码后得到的。

响应结果如下:

  1. 交通网络分析 Path

通过对需要经过的网络结点 ID 数组[ 1,12],获取最佳路径,对 http://localhost:8090/iserver/services/transportationanalyst-sample/wps100 执行 POST 请求,请求体为:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<wps:Execute service="WPS" version="1.0.0"

xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns:ows="http://www.opengis.net/ows/1.1"

xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:schemaLocation="http://www.opengis.net/wps/1.0.0

../wpsExecute_request.xsd">   

<ows:Identifier>Path</ows:Identifier>   

<wps:DataInputs>     

  <wps:Input>     

    <ows:Identifier>points</ows:Identifier>     

    <ows:Title></ows:Title>     

    <wps:Data>     

      <wps:LiteralData></wps:LiteralData>     

    </wps:Data>     

  </wps:Input>       

  <wps:Input>    

    <ows:Identifier>nodeIDs</ows:Identifier>     

    <ows:Title>nodeIDs</ows:Title>     

    <wps:Data>     

      <wps:LiteralData>1,12</wps:LiteralData>     

    </wps:Data>     

  </wps:Input>     

  <wps:Input>     

    <ows:Identifier>hasLeastEdgeCount</ows:Identifier>     

    <ows:Title></ows:Title>     

    <wps:Data>     

      <wps:LiteralData>false</wps:LiteralData>     

    </wps:Data>     

  </wps:Input>      

  <wps:Input>     

    <ows:Identifier>networkName</ows:Identifier>     

    <ows:Title>networkName</ows:Title>        

    <wps:Data>     

      <wps:LiteralData>RoadNet@Changchun</wps:LiteralData>     

    </wps:Data>      

  </wps:Input>   

</wps:DataInputs>    

<wps:ResponseForm>     

  <wps:ResponseDocument storeExecuteResponse="true">     

    <wps:Output asReference="false">     

      <ows:Identifier>FindedPath</ows:Identifier>     

      <ows:Title>FindedPath.</ows:Title>     

      <ows:Abstract>JSON stream describing the finded Path.</ows:Abstract>     

    </wps:Output>    

  </wps:ResponseDocument>   

</wps:ResponseForm>

</wps:Execute>

响应结果如下:

说明:以上请求体中,节点<wps:ResponseDocument storeExecuteResponse="true">,故响应文档中的<wps:Output>节点下的 <wps:Reference>节点记录了分析结果的 url 地址,例如在叠加分析功能 Clip 的响应中,返回了分析结果的 RUL 地址,在浏览器中访问该地址:http://localhost:8090/iserver/services/spatialanalyst-changchun/wps100?request=getxml&file=ClippedPolygon.xml,即可得到 Clip 分析后的结果,该结果也存在于“%SuperMap iServer_HOME%\webapps\iserver\output\xml"文件夹下,若节点<wps:ResponseDocument storeExecuteResponse="fasle">,post 请求后,直接反回分析得到的结果,并不存储该结果文件。