FME Transformers: 2024.2

Categories
Spatial Analysis
Related Transformers
AreaOnAreaOverlayer
Bufferer
Clipper
Intersector
LineOnAreaOverlayer
LineOnLineOverlayer
NeighborPairFinder
PointOnAreaOverlayer
PointOnLineOverlayer
PointOnPointOverlayer
SpatialFilter
SpatialRelator
TopologyBuilder

NeighborFinder

Finds the nearest Candidate feature(s) to each Base feature and merges their attributes onto the Base feature. May also be used in Candidates Only mode, where each feature is considered the Base in turn and compared to all other features, but not itself.

Jump to Configuration

Typical Uses

  • Identifying the nearest feature(s)
  • Identifying features within a specified distance
  • Adding a point closest to a candidate (such as adding a point on a railway track at the closest point to a station)
  • Finding the closest feature in a certain direction (by filtering the resulting candidate angle)
  • Calculating clusters or density by counting neighbors within a set distance

How does it work?

The NeighborFinder generally takes in two sets of features - Base and Candidate. For each Base feature, the transformer checks the Candidates for matches, based on proximity and parameter selections. It may check for the closest Candidate feature, or a fixed maximum number of closest Candidates, or all Candidates that fall within a specified distance of the Base feature.

Attributes from one matching Candidate are added to the Base features, including:

  • Attributes from matching Candidate
  • Calculated attributes containing distance, angle, and coordinates of matches
  • Coordinates of the interpolated point on the Base that is closest to the Candidate

Attributes from multiple matching Candidates may be stored in a List attribute.

Output includes MatchedBase features with these new attributes, Unmatched Base features (unchanged), and Unmatched Candidates (unchanged).

The NeighborFinder works with 2D geometries only; if an input geometry is 3D, its z-coordinate will be ignored. The transformer has full support for points, lines, arcs, ellipses, polygons, and donuts, and has limited support for other types of geometry. Polygons, ellipses and donuts may be processed as lines or areas, depending on user selection.

Candidates Only Mode

The NeighborFinder can be used in a Candidates Only mode, in which only Candidate input features are considered. In this mode, each feature is considered the Base in turn, and compared to all other Candidates (but not itself). Attribute sharing and Output behavior are the same as above.

Candidates-Only Mode is enabled with the Input parameter. When Input is set to Candidates Only, the Base input port is removed.

Examples

Usage Notes

Choosing a Spatial Transformer

Many transformers can assess spatial relationships and perform spatial joins - analyzing topology, merging attributes, and sometimes modifying geometry. Generally, choosing the one that is most specific to the task you need to accomplish will provide the optimal performance results. If there is more than one way to do it (which is frequently the case), time spent on performance testing alternate methods may be worthwhile.

To correctly analyze spatial relationships, all features should be in the same coordinate system. The Reprojector may be useful for reprojecting features within the workspace.

Configuration

Input Ports

If a feature is routed to both the Base and the Candidate input ports, then features will be compared to themselves as they are both a Base and Candidate.

If Input is set to Candidates Only, there will be no Base port. All Candidates will be compared with all other Candidates, but will not be compared to themselves.

Output Ports

Parameters

Editing Transformer Parameters

Transformer parameters can be set by directly entering values, using expressions, or referencing other elements in the workspace such as attribute values or user parameters. Various editors and context menus are available to assist. To see what is available, click beside the applicable parameter.

For more information, see Transformer Parameter Menu Options.

Reference

Processing Behavior

Group-Based

Feature Holding

Yes

Dependencies  
Aliases NeighbourFinder
History  

FME Community

The FME Community has a wealth of FME knowledge with over 20,000 active members worldwide. Get help with FME, share knowledge, and connect with users globally.

Search for all results about the NeighborFinder on the FME Community.

 

Examples may contain information licensed under the Open Government Licence – Vancouver, Open Government Licence - British Columbia, and/or Open Government Licence – Canada.