LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Find the closest location in an array of latitude and longitude

Solved!
Go to solution

 I have a geographical array, and I want to find the closest geographical location based on a given latitude and longitude. For example, if I provide 121.830, 25.1, it should be New Taipei City, Ruifang District. Can someone give me some tips or assistance?

koukileo_0-1690383794785.png

 

chatGPT said that  can try the following method

koukileo_0-1690384029234.png

 

 

0 Kudos
Message 1 of 8
(2,835 Views)

Why don't you further refine it and add "do it in LabVIEW"?

 

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 2 of 8
(2,797 Views)
Solution
Accepted by koukileo

I just solved this problem. I calculated the distance between two sets of latitude and longitude coordinates and found the location with the shortest distance in the array, which is the geographical name closest to the target latitude and longitude.

koukileo_0-1690389203688.png

 

 

koukileo_1-1690388713028.png

 

0 Kudos
Message 3 of 8
(2,783 Views)
Solution
Accepted by koukileo

Since you are merely interested in proximity and not actual surface distance you can easily solve for the Chord Length between each point in your array and the chosen location.

 

Chord Length=((dX^2)+(dY^2)+(dZ^2))^0.5

See here for calculating dX, dY and dZ

 

It's a simple matter the to solve for the chord angle given Diameter = 1 unit Earth and convert to radian Length across a flattish surface with +/-%0.5 accuracy.   Surface distances in the Himalayas will vary more than over calm seas.


"Should be" isn't "Is" -Jay
0 Kudos
Message 4 of 8
(2,782 Views)

that's a good idea!

0 Kudos
Message 5 of 8
(2,772 Views)

You are right, I should have tried it myself on labview instead of asking first. thanks for your teaching

0 Kudos
Message 6 of 8
(2,769 Views)

@koukileo wrote:

You are right, I should have tried it myself on labview instead of asking first. thanks for your teaching


Altenbach is sure to post an example using Polar to Complex and simple subtraction to get dTheta and dPhi.  dRho=0 assuming both points are near sea-level.


"Should be" isn't "Is" -Jay
0 Kudos
Message 7 of 8
(2,748 Views)

Darn, I was hoping to see what ChatGPT was going to say about it.  😄

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 8 of 8
(2,711 Views)