07-26-2023 10:06 AM - edited 07-26-2023 10:08 AM
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?
chatGPT said that can try the following method
Solved! Go to Solution.
07-26-2023 10:57 AM
Why don't you further refine it and add "do it in LabVIEW"?
07-26-2023 11:28 AM - edited 07-26-2023 11:33 AM
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.
07-26-2023 11:30 AM - edited 07-26-2023 11:39 AM
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.
07-26-2023 11:36 AM
that's a good idea!
07-26-2023 11:37 AM
You are right, I should have tried it myself on labview instead of asking first. thanks for your teaching
07-26-2023 12:32 PM - edited 07-26-2023 12:37 PM
@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.
07-26-2023 07:10 PM
Darn, I was hoping to see what ChatGPT was going to say about it. 😄