Question

How to calculate the distance between sets of Eastings and Northings coordinates?

  • 2 August 2019
  • 1 reply
  • 227 views

I have attached a spread sheet with some dummy data to help explain my question. I have a number of Locations and Events with the Easting and Northing for each. I need to calculate the distance between each of the Locations and a number of Events. Outputting the result in a table Distances in km between each of the two points. Loc1 and E1 etc.

On the real data I need to calculate the number of Events that happen at 1km, 2km and 3km form each Location.

The dummy data spread sheet has the input data on Tabs Locations and Events. The required format of output data is show on Tab Distances.


1 reply

Badge +2

Hi @datapiat,

You should be able to do this with the NeighborFinder, a ListSorter, and AttributeManager

Since you have the eastings/northings in the Excel file, you can set the data type to x_coordiante and y_coordinate in the reader parameters, if you are unfamiliar with this be sure to check out this article.

0684Q00000ArLLnQAN.png

Now that you have points created, you can use a NeighborFinder to calculate the distance to each point. To ensure this calculates the distance to each point, clear the value in the Number of Neighbors to Find parameter (by default this is set to 1) and select Generate List to include the Event attribute in the list that is created. 

Next, use a ListSorter to sort the Candidates{}.Event list that was created by the NeighborFinder in alphabetical order. 

Lastly, use an AttributeManager to remove unwanted attributes, convert the units to km, round the values to 2 decimal places, and set the order the attributes. You could do this using multiple transformers or all in the AttributeManager by using Math Functions to set the AttributeValue. For example, E1 could be set to:

@round(@div(@Value(Candidates{0}.distance),1000),2)

I have attached an example that might help. 

 

 NeighborFinder_Example.fmwt

Reply