SpatialFilter
Filters point, line, area, and text features based on spatial relationships. Each input Candidate feature is compared against all Filter features, based on the given spatial tests to meet. Features that pass any test are output through the Passed port; all other features are output through the Failed port.
Note: If you need to determine the relationships between the Filter and Candidate features, or if you have many Filter features, you should use the SpatialRelator transformer. To determine relationships based on proximity, use the NeighborFinder transformer.
For example, if you have a group of features that you want to check against a polygon to isolate those that are inside, the polygon feature would be directed into the Filter port and the group of features would be directed into the Candidate port. Tests to Perform would be set to CONTAINS. Those features that are inside the polygon would come out the Passed output port and those which were not inside would come out the Failed output port.
Input Ports
Point, line, area, and text features against which Candidates will be compared. These features are not output.
Point, line, area, and text features that will be used to compare with Filter input.
Output Ports
Candidate features where at least one of the specified predicates was TRUE with at least one of the Filter features.
Candidate features where all of the specified predicates were FALSE with all of the Filterfeatures.
Filter and Candidate features with invalid geometries will be rejected and output via this port. Candidate features with no or invalid predicates will also be output via this port.
Rejected features will have an fme_rejection_code attribute with one of the following values: EXTRA_BASE_FEATURE, INVALID_BASE_GEOMETRY_NOT_OGC_VALID, INVALID_BASE_GEOMETRY_TYPE, INVALID_CANDIDATE_GEOMETRY_NOT_OGC_VALID, INVALID_CANDIDATE_GEOMETRY_TYPE, INVALID_CANDIDATE_PARAMETER_PREDICATE, INVALID_GEOMETRY_TYPE, MISSING_CANDIDATE_PARAMETER_PREDICATE.
Parameters
Transformer
If Group By attributes are specified, candidates are only compared against filters with the same values in these attributes.
Note: How parallel processing works with FME: see About Parallel Processing for detailed information.
This parameter determines whether or not the transformer should perform the work across parallel processes. If it is enabled, a process will be launched for each group specified by the Group By parameter.
Parallel Processing Levels
For example, on a quad-core machine, minimal parallelism will result in two simultaneous FME processes. Extreme parallelism on an 8-core machine would result in 16 simultaneous processes.
You can experiment with this feature and view the information in the Windows Task Manager and the Workbench Log window.
Yes: This transformer will process input groups in order. Changes on the value of the Group By parameter on the input stream will trigger batch processing on the currently accumulating group. This will improve overall speed if groups are large/complex, but could cause undesired behavior if input groups are not truly ordered. Specifically, on a two input-port transformer, "in order" means that an entire group must reach both ports before the next group reaches either port, for the transformer to work as expected. This may take careful consideration in a workspace, and should not be confused with both port's input streams being ordered individually, but not synchronously.
No: This is the default behavior. Processing will only occur in this transformer once all input is present.
Tests
If the Support Mode is Support Aggregates, both multis and aggregate geometries will be supported. However, the only supported predicates will be Contains, Disjoint, Equals, Intersects, Touches, and Within. The Overlaps predicate and the Crosses predicate will not be supported. 9-character masks representing Dimensionally Extended 9 Intersection Matrices will also not be supported.
If the Support Mode is Support All Predicates, all the predicates described in the Spatial Relations Defined page will be supported. However, aggregate and multi geometries will not be supported.
Defines which tests to perform. If the Support Mode is Support All Predicates, you may also test relationships using arbitrary 9-character masks. Such masks consist of the rows of a Dimensionally Extended 9 Intersection Matrix. Note that in order to use these masks with the SpatialFilter, you must assign them to an attribute on the Candidate features, and include the value of that attribute in the Tests to Perform clause (you cannot specify them directly). Multiple predicates may be specified in one attribute by separating them with a space.
For more information about predicates, see Spatial Relations Defined.
Defines whether the tests are performed using Candidate features' true coordinates or their bounding boxes.
Defines whether a single filter or multiple filters will be given, as well as clarifies the feature order that is expected.
If this parameter is set to Multiple Filters, the SpatialFilter assumes Candidate and Filter features may come in any mixed order, and must wait until all features have entered before performing any filtering.
If this parameter is set to Filters First, the SpatialFilter assumes that all Filter features enter before any Candidate features, and will be able to process the Candidate features immediately as they arrive.
When set to Single Filter, the SpatialFilter assumes that after the first and only Filter feature has entered, only Candidate features will enter, and will be able to process the Candidate features immediately as they arrive.
This parameter specifies whether a candidate must have a predicate match against all Filters or against at least one Filter.
This attribute specifies how to determine the boundary of curve and multicurve geometries. The Default Rule is that any curve endpoints that occur an odd number of times in the geometry as a whole will be considered its boundary – that is, a linear loop (a line whose start point equals its endpoint) will not have any boundary. The other rule specifies that the curve's or multicurve's boundary is the set of all its endpoints.
Output
Specifies an attribute that will be added onto all output Passed features, which will contain the name of the spatial test that the feature passed.
Defines whether attribute merging will take place. If this is enabled, every Candidate that matches a Filter receives that Filter's attributes. The result is an operation known as a Spatial Join.
Merge Filter: The candidate feature will retain all of its own un-conflicted attributes, and will additionally acquire any un-conflicted attributes that the filter feature has. This mode will handle conflicted attributes based on the Conflict Resolution parameter.
Prefix Filter: The candidate feature will retain all of its own attributes. In addition, the candidate will acquire attributes reflecting the filter feature’s attributes, with the name prefixed with the Prefix parameter.
Only Use Filter: The candidate feature will have all of its attributes removed, except geometry attributes that start with fme_. Then, all of the attributes and associated values of the filter feature will be placed onto the candidate.
Use Candidate: If a conflict occurs, the candidate feature values will be maintained.
Use Filter: If a conflict occurs, the values of the filter feature will be transferred onto the original.
Defines a prefix to add onto all attributes that are merged from Filters to Candidates.
Usage Notes
See Spatial Relations Defined for more information on spatial predicates and an illustration of spatial relationships.
Editing Transformer Parameters
Using a set of menu options, transformer parameters can be assigned by referencing other elements in the workspace. More advanced functions, such as an advanced editor and an arithmetic editor, are also available in some transformers. To access a menu of these options, click beside the applicable parameter. For more information, see Transformer Parameter Menu Options.
Transformer Categories
Licensing Level
FME Base Edition
Technical History
Associated FME function or factory: SpatialFilterFactory
Search FME Knowledge Center
Search for samples and information about this transformer on the FME Knowledge Center.
Tags Keywords: MBR "minimum bounding rectangle"