Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check if one location coordinates fall to another location coordinates radius in android

I have latitude and longitude of a current location. I want to check if target location (latitude and longitude) is close with 50 meter radius to the current location.

I am new to android.if anyone have solution about this.please reply.

like image 619
jagdishkumawat Avatar asked Jun 03 '13 10:06

jagdishkumawat


People also ask

How do you track down coordinates?

Get the coordinates of a placeOn your computer, open Google Maps. Right-click the place or area on the map. This will open a pop-up window. You can find your latitude and longitude in decimal format at the top.

How do you find the radius using latitude and longitude?

A circle of latitude at latitude lat=1.3963 rad has the radius Rs = R · cos(lat) = 1106 km, so d=1000 km now corresponds to an angular radius of rs = d/Rs = d/(R · cos(lat)) = 0.9039. Hence, covering d=1000 km on a circle of latitude gets you to longitude lonS = lon ± d/(R · cos(lat)) = -0.6981 rad ± 0.9039 rad.

How do I get GPS coordinates from a dropped pin?

Get Coordinates on Android To obtain coordinates for a location on Android, you'll drop a pin. Tap and hold a spot on the map. You'll see a red pin appear on the map and a Dropped Pin window at the bottom. The coordinates for the pinned location appear in the Search box at the top.


1 Answers

use the built in distance calculation:

Location loc;
.....
float radius = 50.0;
float distance = loc.distanceTo(loc2);
if (distance < radius) then inside.
like image 155
AlexWien Avatar answered Nov 15 '22 15:11

AlexWien