I am working on a use case where I need to retrieve data for retail shops closest to my current location or a given set of geographic coordinates.
I am attempting to implement this using an FME Form; however, I am encountering difficulties in obtaining the current location dynamically.
If anyone has experience or insights on how to effectively retrieve the current geographic location within FME or through any integrated approach, I would greatly appreciate your guidance.
how to effectively retrieve the current geographic location
The current location of what? Your laptop? Your phone? Tablet? A GPS receiver attached to your laptop? Since you are using Form, you’re most likely on a laptop. There are webservices out there that give you a location based on your ip adress, but that is very tricky if you are using an ISP, firewall, or even worse an IT provider somewhere else (the location of my laptop is frequently shown about 25 Km to the northwest of my actual location...).
There are also services out there that will give you coordinates based on an address (personally for worldwide results I use the geocode endpoint of ORS, and the Locatieserver for specific Dutch results). That might even be your best bet, depending on what you have. If you do have a GPS receiver, then the article bwn mentions is probably your best starting point.
Hello everyone,
I wanted to clarify my requirement. I need to identify the retail shops closest to a set of geographic coordinates that I will provide as input.
Currently, I am attempting to accomplish this using the NeighborFinder transformer in FME. However, I am uncertain about the appropriate configuration of the Base File and Candidate File parameters. Specifically, I am unsure of the structure and content these files should contain to facilitate accurate proximity calculations.
If anyone has experience working with the NeighborFinder transformer or has insights into how to set up the base and candidate datasets correctly, your guidance would be greatly appreciated. Thank you!
To assist, perhaps could point to which parts of the Transformer documentation or NeighborFinder tutorial may need clarification?
The “Base” port can usually be taken as the set of From Features, and the “Candidate” port can usually be taken as the set of To Features. For each Candidate geometry found within a distance of the Base geometry, within the limits set by the Maximum Distance, and the Maximum number of “Neighbor” Candidates, NeighborFinder will output the X and Y coordinates of the nearest points between each Base and Candidate Feature Neighbor pair.
Note, both ports will require the Features to have a Geometry. If the input data is instead non-spatiak data with columns of X/Y coordinates, a Geometry for the Features will need to be set using VertexCreator.
In the use case of starting positions vs Retail Shops, then the Starting Positions would be the “Base” (From) Features and the Retail Shops the “Candidate” (To) Features. If you need to find all candidates within a certain maximum distance, ie. There could be >1 matching Candidates, then NeighborFinder also needs to be set to output the matches within a List using the “Generate List” Parameter Setting. The pairs of matches within the output List can be further broken out by a downstream ListExploder Transformer.
Of note is that, obviously, NeighborFinder considers only straight lines between the Base and Candidate features. If the requirement is instead to consider Eg. Driving times or distances over a road network, then instead the workflow would usually use ShortestPathFinder and/or NetworkCostCalculator instead.
What have you tried and what is the issue you have? If you are looking from points A to closest points B, A is base and B is a candidate. Set to find 1 and you are good to go.
Hey Folks,
Thanks for the replies.
Below is the flow that I have created to find nearest location on retail shop.
The flow is running properly with expected output.
But I want to give a location dymanically in the specified location reader. Currently I am taking only one location. I have to take multiple location.
Basically, I want to publish this to FME Flow as an application for user to use this app to find nearest store to specified location.
I have tried using user parameters but its not working.
If anyone has any idea, Kindly help.
Thanks in advance.
I have tried using user parameters but its not working.
What do you mean with “it’s not working”? If you have a parameter for lat and a parameter for lon, you can use those to create a point and feed it to the neigbourfinder, that should not be a problem. So what/how have you tried to do that? Because it would be possible that way to create an FME Flow Webapp and call that with a URL, in which the parameters are url-query parameters. Which means you can easily have a webpage calling that url, and displaying the result.
That said:
Basically, I want to publish this to FME Flow as an application for user to use this app to find nearest store to specified location.
I’m not sure that FME Flow is the right solution for that purpose, but that depends on a lot of factors (who are your users and how many do you expect, are a few concerns). You might want to look at other techniques as well. I do not think I’d use Flow for something like this, personally.