How do I figure out longitude and latitude coordinates to create a 1 mile radius around a user's location?

StackOverflow https://stackoverflow.com/questions/21990405

Question

How do I figure out longitude and latitude coordinates to create a 1 mile radius around the user's location? I don't mind how many coordinates there it takes, but I'd like to create a circular radius around one location.

For instance:

If the user's location is =

Latitude: 44.947 Longitude: -93.098

How do I then figure out what 8 sets of longitude and latitude coordinates create a 1 mile radius around the above location.

(8 in the above example is italicized as I don't mind if it's less or more than 8)

How do I do this?

Code so far:

LocationManager lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
Location location = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER);
double longitude = location.getLongitude();
double latitude = location.getLatitude();

Does anyone have any ideas?

Although I am pleased people are trying to help, the answers given below, don't answer this question.

No correct solution

OTHER TIPS

Bearing in mind that I'm not experienced in Android so if this doesn't apply ignore me.

With the web version, the easiest way to achieve what you're looking for is to use the drawing API to create a circle of the radius you're looking for (in this case a mile) centered on your users location. You can then use the built in methods to find the corner bounds points of this object (unfortunately rectangular) to give you the long/lats you're looking for.

If you want to create a circle on map then do this:

1) Get a refference to your map fragment :

GoogleMap = MyMap;
MyMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map_id)).getMap();

2) Draw the circle:

MyMap.addCircle(new CircleOptions().center(new LatLng(latitude,longitude)).radius(0.00062).fillColor(0x88000000).strokeColor(0x44000000).strokeWidth(2));

1 meter = 0.000621371 miles

If you don't know how to use Google Maps API v2 then follow this link

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top