span8
span4
The FeatureReader,SpatialRelator and SpatialFilter transformers are great tools for performing spatial queries on data in FME workbench.They allow you to quickly select your query parameters without the need to fuss over the syntax of database-specific SQL.
This article describes how to use the FeatureReader to perform spatial and/or attribute queries.In workbench,you need to connect the features you wish to use in your spatial query to the Initiator port of the FeatureReader transformer.If you're performing a spatial query,it is important that the geometry of the query feature is in the same coordinate system as those to be read using the FeatureReader.The CSMapReprojector or Reprojector transformers can be used for this purpose.
Spatial Query using FeatureReader - FME 2017
Spatial Query using FeatureReader - FME 2016
The download spatialquery-featurereader.fmwt is the complete workspace.If you would like to create the workspace yourself,please download vancouverneighborhoods.kml,and follow the steps below to create it.
完成工作区
1。Inspect Source Data
添加一个Google KML阅读器,并将数据集设置为vancouverneighborhods.kml。In Data Inspector,请注意不同的邻域多边形,one neighborhood will be used to create a spatial query in the FeatureReader.
数据检查器中的vancouverneighborhods.kml
2.重新设计
The source KML data must be in the same coordinate system as the database data.KML始终处于LL84坐标系中。添加csmapreprojector,leave the Source Coordinate System as
三。Extract Bounding Box
测试人员提取空间查询中要使用的感兴趣区域。在这个例子中,one of the neighborhoods,费尔维尤is used.You could build a parameter that is a list of 'hoods.
4.Add FeatureReader
对于格式,请输入postgis并将dataset设置为嵌入连接参数。Under Parameters...请输入:
Host:postgis.train.亚搏在线safe.com网站
端口:5432
Database: fmedata
Username: fmedata
Password: fmedata
Schema: fmedata2015
Set Schemas for Table Listing to fmedata2015
In Feature Types to Read,请选择PostalAddress.
设置FeatureReader的查询约束参数。要执行空间查询,请使用空间过滤器参数选择空间谓词。在这个例子中,Spatial Filter is set to Contains so that only features which are within the Fairview neighborhood polygon will be returned.
FeatureReader parameter Spatial Filter set to Contains spatial predicate
You can use the WHERE Clause parameter to constrain the data using an attribute query.请注意,此WHERE子句将应用于您选择要读取的所有表。Try adding a WHERE Clause and compare the difference:
“状态”不像“退休”
5.Inspect Result
当查询结果连同边界框一起发送给数据检查器时,we can see that the FeatureReader returns only the point features that are contained by the bounding area - the Fairview Neighborhood.
PostalAddress points within the Fairview neighborhood
Let the database do the work is a good adage to follow when ever possible.Having the database perform the spatial query and return only the query results is generally going to give better performance than reading the entire table and filtering in FME.
Another example showing how to use the执行本机空间查询的SQLExecutor.
Creating and Associating Geodatabase Domains Dynamically Using A Feature Class and GDB Table
Using the InlineQuerier as a replacement for multiple FeatureMergers
Extract Geodatabase Coded Domain Definitions
Performing native spatial queries on database tables using the SQLExecutor
使用PointOnAreaOverlayer计算多边形中的点
Using the SQLExecutor or SQLCreator to issue commands to a database
© 2019 亚搏在线Safe Software Inc |Legal