斯潘8
斯潘4
Using the OGC Web Feature Service (WFS) provides accessibility for your spatial data,这意味着任何可以使用Web服务的应用程序现在都可以访问地理信息。WFS服务可以返回具有几何图形和属性的特征,还支持过滤器,允许用户执行空间和属性查询。After running through this guide you will have a functional WFS Service on your FME Server and be able to serve you own spatial datasets.
注意:这个工作区包含python。为了与python 2.7兼容,FME 2019将标志着逐步淘汰过程的开始。更多信息,请阅读python 2.7折旧.
Python 2.7 Deprecation Warning shown in FME Workbench 2018.1
For this tutorial,all that is necessary to set up the WFS,是附加的工作区和您选择的数据。Your data can come from a variety of sources,从复杂的数据库(例如PostGIS) to a simple shapefile.
The attached download package is ready to publish to FME Server and is set up to read and serve layers from the included sample SpatiaLite database.You may wish to publish the sample and test it in your desired WFS client before modifying the workspace to serve your own data.
在Workbench中打开genericwfs.fmw,并执行以下步骤:
Find the FeatureReader transformer using the Navigator
将数据集更改为数据所在的路径
In the Navigator panel find the Private Parameters section under User Parameters:
修改导航器中的私有参数以适合您的数据
使用导航器的书签部分查找工作区的一部分。
Use an AttributeValueMapper to set the titles and abstracts to be displayed for each feature.
将工作区发布到FME服务器上的数据流服务。
让FMEguest在FME服务器上的角色访问WFS所在的存储库。
有很多方法可以确保WFS服务正常工作。Listed below is a simple web browser based method however as WFS is a standard you can use multiple tools.For example,软件包,如Arcgis,Autodesk IMS,QGIS有连接到WFS服务的方法,并且在FME工作台中也有一个WFS阅读器。
Browser:
要验证WFS服务,请使用getCapabilities请求。生成的XML流将提供有关服务可用功能的信息,包括哪些功能类型可用。
在浏览器的地址栏中输入以下内容,必要时编辑字符串:
http://
If you have set up your services correctly you will receive a string of XML:
Test the WFS service is running correctly using the GetCapabilities request.
在发布到FME服务器之前测试工作区修改要快得多。然而,在这种情况下,工作区需要一些只有FME服务器才能提供的信息。因此,为了正确测试工作区,我们可以手动向FME工作台提供这些信息。下一节将介绍如何测试GET和POST请求。
响应GET请求时,工作区使用调用它的URL来确定要响应的请求类型,以及要返回的层和WFS版本。为了在FME工作台中成功运行此工作区,我们需要提供示例URL。
The workspace responds to three different types of requests (GetCapabilities,DescribeFeatureType,and GetFeature),所以我们需要每个样本来完全测试它。
The easiest way to get these sample URLs is to publish the initial workspace to a sample repository and then using the Direct URL used to run this workspace within an WFS Reader in FME Workbench.
在FME服务器Web界面中,导航到GenericWFS工作区并单击它。From the Run Workspace page there is an Advanced section,this is where you will find the Direct URL.
高级部分中的直接URL位置
Return to FME Workbench and open a blank workspace.添加WFS读卡器,并为数据集复制位于上面的此URL。
Open up the Parameters… and under Constraints > Feature Types check the Select all button.You can also define the WFS Version in this window.
在WFS读卡器参数中选择要素类型
Run the workspace,then examine the log window for lines starting with
搜索三个WFS GET请求URL
Return to the GenericWFS.fmw file.To test the workspace you can enter these URLs in the Navigator Window under User Parameters > FME Server Parameters >FME Server Request URI.
一次只能测试一个请求。Additionally,在URL内,您可能需要修改typename=<>参数,以仅包括源数据中可用的那些。This parameter is equivalent to exposing feature types in the constraints of the WFS Reader.
添加get urls作为fme-server-request-uri参数,并更改typename语法
每个请求的输出将写入与工作区相同的文件夹,文件名为return.xml。
为测试目的生成POST请求有点复杂,首先需要根据在FME服务器上的作业日志文件中创建的信息创建一个XML文件。然后将使用此文件的内容,而不是上面所示的GET请求示例中的直接URL。
从一个空白画布开始,并像上面所做的那样添加一个WFS阅读器。然而,这一次在参数中…公开连接属性并检查首选HTTP POST选项。
首选启用HTTP Post
运行工作区,然后返回到FME服务器Web界面,选择Jobs>Completed(作业>已完成),您将看到在FME Workbench中运行WFS Reader已触发最后三个要运行的作业-三个请求中的每一个都有一个作业:getCapabilities,描述FeatureType和GetFeature,按这样的顺序。
FME服务器已完成作业网页
为了满足WFS POST请求,我们需要从日志文件中提取XML片段,并将其提取到先前创建的useParameters.xml文件中。FME总是作为GET请求提交getCapabilities,所以我们只看最后两个工作。您可以使用以下XML创建自己的post-getcapabilites请求(根据需要更改版本):
Search for xml_fragment in job log
Click on the second job to open the job dialog,from here you can either search within the log on the web page (Ctrl+F) or download the log file.Search for xml_fragment and copy all the text within the angle brackets <>.
在文本编辑器中,选择“新建”,并将文件另存为useParameters.xml,保存位置与工作区相同。现在从日志文件中选择XML文本(这可能跨越多行),并将其复制到useParameters.xml文件中。
Save xml_fragment from DescribeFeatureType and GetFeature in useParameters.xml
对DescribeFeatureType和GetFeature作业日志重复此过程以测试POST请求-在原始工作区中,作业应成功运行,为每个请求生成输出文件,而无需像对GET函数那样指定FME服务器请求。
测试完成后,the useParameters.xml file should be deleted before the workspace is published to FME Server.
本教程创建的WFS服务包含以下操作:
筛选可用于使用GetFeature操作对WFS服务数据执行查询。此工作区支持以下筛选器:
属性筛选器:
空间过滤器:
genericwfs.fmw工作区中过滤选项的位置。
属性筛选语法示例:
BikePathName 海边
获取请求中使用的筛选器:
http://
Example Spatial Filter Syntax:
bbox=-71.4,42.3,-71.1,42.6
完全请求:
http://
以下是可以连接到WFS服务的第三方客户端列表:
OGC Website:WFS标准
FME格式:WFS阅读器
WFS教程:启发WFS教程
故障排除:WFS错误故障排除
此处使用的数据源于温哥华市,British Columbia.It contains information licensed under the Open Government License - Vancouver.
?2019安全亚搏在线软件公司|合法的