# Calculate distance from all points to all lines within 10km using FME?

I have a polyline shapefile and a point shapefile. The points are along the polylines. There are over 100 lines and over 10,000 points. I want to calculate the perpendicular distance from every point to every line within 10km except for the line that the point is on.

I'm happy to calculate lines representing these distances. My first thought was to use the NeighborFinder transformer. However, this only seems to calculate the nearest line which is the line that the point is on (zero distance).

Sample image of data: Is there a way to have the NeighborFinder find all of the closest lines within 10km? How else can I accomplish this? Perhaps a looper?

• PolylineAnalyzer creates vertex numbers, angle, distance can be done with a nearset neighbour (use a tester to remove the first point) store.safe.com/transformers/PolylineAnalyzer.htm – Mapperz Feb 24 '15 at 1:48
• @Mapperz, I don't see how the PolylineAnalyzer will help me here. I want to calculate distance from the points to all lines. I don't need to analyse vertices or angles of the polylines. – Fezter Feb 24 '15 at 1:56
• there is more to the custom transformer use can use tester for the angle to be perpendicular distance with the nearest neighbour – Mapperz Feb 24 '15 at 1:57

I have figured this one out.

I ended up using the NeighborFinder as I initially suspected. The trick is to store all candidate details in a list (I called it NeighbourList). I then connected that to a ListExploder to create features from all elements in the list. Then I used a tester to filter out the features with a distance of zero. Finally, I used a VertexCreator to add a vertex at the candidate location to make a line.

The results are: There is still some work needed to get rid of non-perpendicular lines at the bends of the black lines. But generally, the results are good. Note the gap is where the lines are greater than 10km apart.