Out of my depth a little :-) How do I create a pair of longitude and latitudes to create a polygon showing a 2 mile radius of a particular longitude and latitude? in Java Android. I know how to find your current longitude and latitude but I just can't figure out the above.

My code so far is below:

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

Click Here for a resource.

Also Here is another resource.

Here is another.

Those resources don't really help (as from what I understand of Haversine formula, it requires 2 sets of longitudes and latitudes from the onset. Which is what I'm trying to attain via this question) do you personally have any opinions or skills in this field which can help?

I'm no expert, but maybe this will help:
There's a simple formula for the distance between two long/lat points (Google!). You can rearrange that that to make the distance fixed and either the second long or the second lat the unknown. This will give you four new long/lat points, N.S.E.amd W of the original by the exact distance - thus defining a polygon. With a bit more math you can solve it to get the four points NE,NW.SE and SW, and with a bit more math again any of the infinite number of points that lie on your circle.
If I'm missing yout point here, just ignore this.

I apologise, I've made a mistake. There should actually three pairs of longitude and latitude coordinates to form a radius of 2 miles around the user's location expressed earlier. Hopefully this helps. sorry again :-)

So that's any three points on the circle? Eg 2 miles North, 2 miles South 2 miles East of the location?

No, I'm asking how I figure out the longitude and latitude coordinates necessary to create a 1 mile radius around the user's location?(expressed above) I don't mind how many coordinates there it takes, but I'd like to create a circular radius around one location.

You need to decide how "smooth" you want your circle to be if you are approximating it by a polygon. Three points is the minimum to define a 2D area, but a smooth circle may require dozens to hundreds of points. Is that really where you want to go?
You don't describe the application, but do you not have access to a method that draws circles?

Do you know how to accomplish this (within java, Android), regardless how many points there ends up being?

Application (what I'm wanting to accomplish):

  1. System identifies user location in longitude and latitude (as above)

  2. System then utilises user location ( longitude and latitude) to form a radius of 2 miles from user's location by means of a polygon parameter expressed as multiple pairs of longitude and latitude coordinates

Actually, mathematically a circle is defined by its center and radius so that's all you need to know to store the data.
I wouldn't be at all surprised if the graphical API you're using has a method that will draw a circle on screen using those same things. And then it's just a question of converting the data you have to the coordinate system required for the API (it won't need geographic coordinates and miles but pixel coordinates and number of pixels), which is a scaling problem you'll have to write something for (or which might exist as part of that same API if it's intended for geomapping).

^ that's what I thought too, and I asked him if he had any circle-drawing methods available, but his answer is perfectly clear: "by means of a polygon parameter expressed as multiple pairs of longitude and latitude coordinates". So I guess that's that.

The api doesn't seem to offer much help in that regard.
I mean no disrespect. Although what has been mentioned within this thread, has been insightful. As of yet no one has suggested any Java code which could help me solve this problem. I don't expect anyone to do all the work for me, but I hoped someone would be able to help with the coding. Which is why I've come to a Java forum, is anyone able to help in this fashion?

Maybe a misunderstanding? This is a forum where people can come for help with their Java code. It's not a free coding service.
I posted some formulae and algorithms that should solve your problem as stated. If you have difficulty coding that then post what you have been able to do, and explain exactly what is blocking your progress.

hmm, "no one has posted the code" followed directly with "I expect no one to do my work for me". That's contradicting yourself...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.