Skip to main content

Hi! I am quite new to FME, and worked my whole career so far with ArcGIS. Some things are quite easy in ArcGIS, but super confusing in FME (and vice versa). My problem is this:

I have 2 shapefiles, both with many points. Of the points in shapefile A, I need to find for each point the top 5 closest point features in shapefile B (up to a maximum distance), and also know what the distance is between these points. Furthermore, I need the attributes of both shapefiles to merge.

In ArcGIS this is incredibly easy, I just use 'point distance' and state the 'input' features (Shapefile A) and near features (Shapefile 😎, and set the maximum distance. It then automatically give me how far points in Shapefile A are form Shapefile.

How do I do this in FME? The Neighborfinder seems like the tool I should use (shapefile A = base, Shapefile B = candidates), but I can't get it to work and it rejects all features (yes, it is in the same coordinate system, and both are point shapefiles).

Help is very much appreciated, thanks.

Hi @wolters

I'm not sure why the NeighborFinder would reject data, but it's certainly the right transformer to use. I made a video demonstration and you can find it here:

https://www.screencast.com/t/wtPc7cXE

I'm finding the nearest five parking meters to an address. Because I know I want five features it's easier to map the output schema. If it was the closest X parking meters (any number of meters within, say, 100metres) then it would be harder to handle. You wouldn't know how many attributes you'd need on the output. But hopefully that doesn't apply here.

The issue I had - and I was trying to explore that when the recording cut off - is that of duplicate distances for two meters. I think that might be because these parking meters are twin heads, so that there are two meters at the same location. When it is a single head meter, then there is no duplication. But let me know if you try this technique on your data and find a similar problem.

As for the feature rejection - I think I'd have to see a log file and maybe your workspace and data to be sure what is happening. Best way for you to debug is to check the feature counts on FME connections and to add Inspector transformers, so that you can see what the data looks like at each step. Hopefully that will let you pin down where and what the issue is.

Hope this helps

Mark


Agree that the NeighborFinder would be the way to go. The features output from the Rejected port have "fme_rejection_code" attribute which stores a short description on the reason for rejection and it could also be a hint to know what happened.


@Mark2AtSafe, @takashi

Thank you both, I made it work. Apparently the point shapefile I was using was corrupt. With the help of Mark I understand the neighborfinder a lot better, thank you!


Reply