Derek Morgan

Greenhorn

Posts: 3

posted 3 years ago

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:

My code so far is below:

posted 3 years ago

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.

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

posted 3 years ago

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?)

(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

posted 3 years ago

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 :-)

posted 3 years ago

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.

Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |