You are here: FME Transformers > Collectors > NeighborFinder

NeighborFinder

Finds the closest CANDIDATE feature within a specified maximum distance of each BASE feature.

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 there is only a connection made to the CANDIDATE port, but not to the BASE port, then all CANDIDATEs will be compared with all other CANDIDATEs, but will not be compared to themselves.

Output Ports

If there are no CANDIDATE features found to be within the maximum distance, then the BASE feature will be output unchanged via the UNMATCHED_BASE port.

CANDIDATE features not close enough to any BASE feature are output via the UNMATCHED_CANDIDATE port.

If a CANDIDATE feature is found, then all the attributes from the closest CANDIDATE feature are added to the BASE feature and the BASE feature is output via the MATCHED port. In addition, several other attributes are added to the BASE feature just prior to it being output via the MATCHED port:

Attributes Description
 _distance The distance from the BASE to the matching CANDIDATE
 _angle The angle between the closest interpolated BASE point and the closest interpolated CANDIDATE point.
 _closest_base_x, _closest_base_y The coordinates of the closest interpolated point on the BASE feature relative to the CANDIDATE feature.
 _closest_candidate_x, _closest_candidate_y The coordinates of the closest interpolated point on the CANDIDATE feature relative to the BASE feature.
 _candidate_angle The angle from (_closest_candidate_x, _closest_candidate_y) to the next vertex within the CANDIDATE feature. If (_closest_candidate_x, _closest_candidate_y) equals the last vertex of the CANDIDATE feature, then candidate_angle will be the angle from the previous vertex of the CANDIDATE feature to (_closest_candidate_x, _closest_candidate_y).
 _candidate_label_angle The _candidate_angle adjusted so that if it is used as a text rotation, the text will run from left to right.  This angle is guaranteed to be greater than or equal to 270 and less than 360, or greater than or equal to 0 and less than or equal to 90.

Invalid features (i.e. extra candidates) are output via the <REJECTED> port.

Parameters

Geometry Handling (applicable to some FME workspaces prior to FME 2012)

If the Advanced setting Geometry Handling is set to Enhanced in the workspace, arcs and ellipses will have their boundaries considered in distance calculations; otherwise, their centerpoints will be used.

Editing Transformer Parameters

About Transformer Parameter Options

Transformer Categories

Collectors

Example

All angles are measured in degrees counterclockwise from horizontal. Where angles are not well-defined (for example, when a CANDIDATE polygon is contained inside a BASE polygon), they are set to 0.

Usage Notes

This transformer works with 2D geometries only; if an input geometry is 3D, its z-coordinate will be ignored.

This 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.

FME Licensing Level

FME Professional edition and above

FMEpedia

See the NeighborFinder page in FMEpedia for additional information and examples that use this transformer.

 

Search FMEpedia

Search for samples and information about this transformer on FMEpedia.

Keywords: MBR "minimum bounding rectangle" neighbourfinder