This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Android and the fly likes How do I create a pair of longitude and latitudes to show a 2 mile radius of a particular longitude Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Mobile » Android
Bookmark "How do I create a pair of longitude and latitudes to show a 2 mile radius of a particular longitude " Watch "How do I create a pair of longitude and latitudes to show a 2 mile radius of a particular longitude " New topic
Author

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

Derek Morgan
Greenhorn

Joined: Feb 23, 2014
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:
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

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

Joined: Feb 23, 2014
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
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

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

Joined: Feb 23, 2014
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
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

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.
Norm Radder
Ranch Hand

Joined: Aug 10, 2005
Posts: 685
Also posted at: http://www.java-forums.org/android/85672-how-do-i-create-pair-longitude-latitudes-show-2-mile-radius-partic.html
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How do I create a pair of longitude and latitudes to show a 2 mile radius of a particular longitude
 
Similar Threads
GPS Accuracy
it doesn't give me the country name
it doesn't change the longitude & latitude
Can method return two values?
is there any way to trigger onLocationChanged other than moving