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

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.

Defining Values

There are several ways to define a value for use in a Transformer. The simplest is to simply type in a value or string, which can include functions of various types such as attribute references, math and string functions, and workspace parameters. There are a number of tools and shortcuts that can assist in constructing values, generally available from the drop-down context menu adjacent to the value field.

Dialog Options - Tables

Transformers with table-style parameters have additional tools for populating and manipulating values.

Reference

Processing Behavior

Group-Based

Feature Holding

Yes

Dependencies  
Aliases NeighbourFinder
History  

FME Community

The FME Community is the place for demos, how-tos, articles, FAQs, and more. Get answers to your questions, learn from other users, and suggest, vote, and comment on new features.

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

 

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