I have a DB with 8000 locations and their coordinates in WGS84, I need to give those locations a certain “action range” of 5/10Km ,if the user is in the given range the method should return true
I managed to get an approximate user location from the front end using navigator.geolaction and it returns latitude and longitude in WGS84
Lets use Rome as an example:
lng:12.48366723 , lat:41.89277044, those are approximately the coordinates of the Colosseum, which is basically the center of the city. The user is at Lng: 12.4724649 Lat: 41.8210742, 7.83km away from the city center…….the method should return true
How can I define the “range” and tell if the user is in the range?
I’m using springBoot angular11 and PostgreSQL
Advertisement
Answer
This is more into maths. The equation is like below: (x – center_x)² + (y – center_y)² < radius²
Range should be radius.