span8
span4
The FeatureReader,空间中继和空间滤波器变压器是在工作台中的数据库上执行通用空间查询的重要工具,它们允许您快速地选择查询参数,而无需为特定于数据库的SQL语法操心。However if you are performing spatial queries on extremely large datasets and you aren't afraid of writing a little bit of SQL,you may benefit from the performance gains of implementing your spatial query with a native SQL statement in the SQLExecutor transformer.
In workbench,您需要将您希望在空间查询中使用的基本特性连接到sqlExecutor转换器的输入端口。对于这些查询,以数据库友好格式存储几何图形是很重要的;In the example workspace below the geometry has been extracted to OGC Well-Known Text (WKT) format with a GeometryExtractor transformer before being passed to the SQL executor.
In the parameters dialog of the SQLExecutor transformer fill in the ‘Reader' section parameters with the format and connection details of the database you wish to query.Under the ‘Parameters' section click on the 3 dots next to SQL statement parameter,this will open up a text editor that allows you to compose an SQL statement.
Various databases differ slightly in the required syntax of their spatial queries.The best way to get started is to read the documentation provided by the spatial database that you are using.
Here is an example of an SQL statement that queries features from a PostGIS database based on the geometry of an input bounding box that was created in workbench:
SELECT *
FROM fme."ADDRESS_POINTS" as ap
其中st_within(ap.geom,st_geomfromtext('@value(_geometry)',2277))=真
The query returns the rows of the ‘ADDRESS_POINTS' table of the 'fme' database where the ST_Within function evaluates to true.The ST_Within function takes two arguments: the first is the name of the geometry column (ap.geom) of the candidate features in the database table,the second is the base geometry generated by the ST_GeomFromText function,which itself takes two arguments: the value of the WKT geometry attribute of the input bounding box feature and a four digit Spatial Reference ID (SRID).
When the result of the query along with the bounding box is sent to the inspector,we can see that the SQLExecutor returns only the point features that fall within the box.
Performing native spatial queries on database tables using the SQLExecutor
使用sqlExecutor或sqlCreator向数据库发出命令
Using the SQLExecutor to do a SQL Join
使用FME在Microsoft SQL Server上执行存储过程
The SQLCreator and SQLExecutor Transformers
Writing custom data types to an Oracle table
© 2019 亚搏在线Safe Software Inc |Legal