Question

Join points to nearest line and summarise

  • 21 December 2016
  • 3 replies
  • 23 views

I have two datasets:

1) road (line)

 

2) incidents (points)

 

 

I need to join the incidents to the nearest line and summarise how many points are on each line. I have tried NeighborFinder but I only get results coming out of the reject port. this would be a simple spatial join in Arc/QGIS and I'm sure there's a transformer(s) in FME that does this.


3 replies

Userlevel 2
Badge +12

The NeighborFinder only rejects objects without geometry. You could check on the geometry type by using a GeometryFilter.

Another issue could be if the points and lines are in different coordinate systems.

If this is solved the NeighborFinder should be the right transformer.

Badge
Firstly, run the data through a GeometryFilter to make sure FME sees the points as points and the line as lines. Your points should be the Base and the line should be the Candidate.

 

 

Before the points enter the NF, attached a Counter. This will give each road a unique count. You can then (after the NF) use a StatisticsCalculator to give the Total Count, with Group By set to the Counter value. This will give you number of points per road (i.e. the count). If each road has a unique name/attribute, you can use this in lieu of the Counter. You need to exit the Complete port of the SC to get all the points.

 

Thanks @amit your suggestion worked perfectly

Reply