Solved

NeighborFinder Multiple candidate feature types

  • 7 August 2017
  • 6 replies
  • 13 views

Badge +5

Hi FME'ers

I am pulling together a dataset containing the nearest three of each POI to an address from a list of addresses. E.g nearest three schools, nearest three recycle centres etc.

I have used the NeighborFinder with the address feature type (Base) and the Schools feature type (Candidate). All works well but as I said, I need to find the nearest three of different feature types.

Is there a way of passing multiple feature types into the candidate port of a single NeighborFinder or do I have to use a new NeighborFinder for each POI feature types?

Thanks,

David

icon

Best answer by davideagle 7 August 2017, 17:55

View original

6 replies

Badge +14

One option is take your addresses and join them to an external resource, say a spreadsheet that identifies which "find my nearest" (FMN) searches to make, this join needs to clone the address and tag the type onto each address. Alternatively if you need to do 3 FMN checks, then use Cloner to multiply your addresses by 3 and tag each address with an attribute like _FMN, where it is set to "Recycling", "School", and "Bus" (the same names as perhaps the layer name that contains the POI), then pass through your NeighbourFinder and 'GroupBy' the layer of POI you are using, making sure the name matches the values in _FMN. Add a candidate list to the feature so you can then see for each address, its nearest 3x things. This method gets you features you could explode out into say separate sheets in an XLS.

Badge +14

One option is take your addresses and join them to an external resource, say a spreadsheet that identifies which "find my nearest" (FMN) searches to make, this join needs to clone the address and tag the type onto each address. Alternatively if you need to do 3 FMN checks, then use Cloner to multiply your addresses by 3 and tag each address with an attribute like _FMN, where it is set to "Recycling", "School", and "Bus" (the same names as perhaps the layer name that contains the POI), then pass through your NeighbourFinder and 'GroupBy' the layer of POI you are using, making sure the name matches the values in _FMN. Add a candidate list to the feature so you can then see for each address, its nearest 3x things. This method gets you features you could explode out into say separate sheets in an XLS.

A scrappy example of what I mean. scrappy-example.fmw

 

 

Badge +3

or create a Cartesian product of the 3 dataset with the addresses.

Calculate distance sort ascending and keep first 3 grouped by adresse and featuretype.

Or if you have streetnetwork do distance calculate on topology and keep 3 nearest.

Or loop neighbour finder and add keep candidates. (wich I do..)

Or as SpatialDave said, duplicate addresses by number of feature types, and create group_by based on featuretypes.

Badge +5

One option is take your addresses and join them to an external resource, say a spreadsheet that identifies which "find my nearest" (FMN) searches to make, this join needs to clone the address and tag the type onto each address. Alternatively if you need to do 3 FMN checks, then use Cloner to multiply your addresses by 3 and tag each address with an attribute like _FMN, where it is set to "Recycling", "School", and "Bus" (the same names as perhaps the layer name that contains the POI), then pass through your NeighbourFinder and 'GroupBy' the layer of POI you are using, making sure the name matches the values in _FMN. Add a candidate list to the feature so you can then see for each address, its nearest 3x things. This method gets you features you could explode out into say separate sheets in an XLS.

Hi @1spatialdave

 

 

Does your suggestion involved having a Cloner per POI feature type?

 

Is there any performance benefit using the method you have outlined or it is just the same/similar to having a separate NeighborFinder per POI feature type?

 

 

Thanks

 

Badge +14
Hi @1spatialdave

 

 

Does your suggestion involved having a Cloner per POI feature type?

 

Is there any performance benefit using the method you have outlined or it is just the same/similar to having a separate NeighborFinder per POI feature type?

 

 

Thanks

 

I mean like this scrappy-example2.fmw - You could have separate NeighbourFinders but there's no need, but it does sort of depend on how many addresses you're checking. This way at least you could introduce new checks without editing the workspace. The most performance benefit is gained by making sure you control the order you read your source data and then adjust the NeighbourFinder parameters accordingly i.e. make sure you read your addresses second, so that they arrive after the POI have arrived as there will be fewer of the POI.

 

 

Badge +5

One option is take your addresses and join them to an external resource, say a spreadsheet that identifies which "find my nearest" (FMN) searches to make, this join needs to clone the address and tag the type onto each address. Alternatively if you need to do 3 FMN checks, then use Cloner to multiply your addresses by 3 and tag each address with an attribute like _FMN, where it is set to "Recycling", "School", and "Bus" (the same names as perhaps the layer name that contains the POI), then pass through your NeighbourFinder and 'GroupBy' the layer of POI you are using, making sure the name matches the values in _FMN. Add a candidate list to the feature so you can then see for each address, its nearest 3x things. This method gets you features you could explode out into say separate sheets in an XLS.

Thanks @1spatialdave. Unfortunately we are still running FME 2016 so some of the transformers you have included down work. When I have upgraded I will give it a look.

 

Reply