programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Sheriffs:
Saloon Keepers:
Bartenders:

# How do I create a pair of longitude and latitudes to show a 2 mile radius of a particular longitude

Greenhorn
Posts: 3
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:

Sheriff
Posts: 23429
46
Hi Derek, welcome to the Ranch!

Am I right in guessing that it's the math for calculating the lat/longs which are 2 miles away from that lat/long which is your problem? I found a page with that sort of formula here: Calculate distance, bearing and more between Latitude/Longitude points.

Near the bottom there's a section headed "Destination point given distance and bearing from start point". It has a formula in JavaScript, which is very much like Java in this regard, so you could start with that.

Derek Morgan
Greenhorn
Posts: 3
Yeah. I'm trying to generate a pair of longitude and latitude coordinates, to form a radius of two miles from a particular point. I down that page but couldn't really make heads or tails of it. Have you got any understanding in this area?

Paul Clapham
Sheriff
Posts: 23429
46
Do I have expertise in that area? Actually I do. But if you didn't do trigonometry in any of your classes then you're going to have trouble with this because you don't understand what's going on. And applying the formulas blindly wouldn't be a good idea because you wouldn't recognize when you made a mistake.

(For one thing the points which are 2 miles from a particular lat/long form a circle, so already when you say you want to generate a point, there's something missing. A random point on that circle? Some particular point?)

Derek Morgan
Greenhorn
Posts: 3
The point I think you're referring to, is explained briefly above. The user initiates the earlier mentioned code to find their current location, then this data is expressed as a set of longitude and latitude coordinates. From which I intend to generate a further set of coordinates showing a 2 mile radius from that location using help I hopefully get here :-)

Paul Clapham
Sheriff
Posts: 23429
46
Okay. So what help do you need? Remember, we don't do people's work for them here. So if you don't know what sine and cosine are (you didn't answer that) then the first step is to go off and learn basic trigonometry. You don't need to pass the whole course but you'd probably have to go through the first couple of lessons.

Master Rancher
Posts: 2862
32