Find the nearest location value between latitude and longitude entered and latitude and longitude within the csv file

Asked 1 years ago, Updated 1 years ago, 342 views

You want to find the nearest location value between the latitude and longitude you entered and the latitude and longitude in the csv file. In the csv file, it is divided into latitude, longitude, and location name, and I want to find the closest between the latitude and longitude entered with them and even find directions through Naver api. Please give me a lot of help.

python

2022-12-20 08:52

1 Answers

If you were to find the distance between the two points (a,b) (x,y) in Euclidean plane coordinate system, you would have derived it from the Pythagorean formula in middle school.

a = 0
b = 0
x = 3
y = 4
print(((x-a) ** 2 + (y-b) ** 2) ** 0.5) # How long is the hypotenuse of a right triangle with a base of 3 and a height of 4?

You can turn for the coordinates in CSV, calculate the distance with this formula, find the min among them, and ask Naver's directions API.


2022-12-20 09:24

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.