Jump to content
Sign in to follow this  
Herb191

Math/Random Question

Recommended Posts

Herb191

Math/Random Question

How would I randomly get all of the latitude and longitude coordinates within 25 miles of a known latitude and longitude point? I would like to be able to randomly cycle though all of the latitude and longitude coordinates within 25 miles of any point without repeating a coordinate.

Right now I am using GEOSsoft’s distance UDF to get the distance between any to points but I am not sure how to get ALL of latitude and longitude coordinates within a certain distance.

What I am using now:

$Distance = _Haversine($Lat1, $Lon1, $Lat2, $Lon2)

Share this post


Link to post
Share on other sites
PsaltyDS

The math should be pretty basic, since there are exactly 60 nautical miles per degree of latitude or longitude (69.04 statute miles). So there is no complicated conversion to do, i.e. 25nm/60 = 0.417deg, or 25sm/69.04 = 0.362deg.

Getting ALL coordinates anywhere requires an answer to the resolution you want. A 10nm grid? 1nm grid? 100yd grid? Feet, inches? How big a table do you want to make?

It would be more sensible to arrange things where you can just test a given value to see if it's in range. Trying to create a huge table of all possible values is not efficient for most uses.

:mellow:

It's not as simple for longitude as it is with latitude, as pointed out by Darknvader500a, below.

:P

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
Herb191

The math should be pretty basic, since there are exactly 60 nautical miles per degree of latitude or longitude (69.04 statute miles). So there is no complicated conversion to do, i.e. 25nm/60 = 0.417deg, or 25sm/69.04 = 0.362deg.

Getting ALL coordinates anywhere requires an answer to the resolution you want. A 10nm grid? 1nm grid? 100yd grid? Feet, inches? How big a table do you want to make?

It would be more sensible to arrange things where you can just test a given value to see if it's in range. Trying to create a huge table of all possible values is not efficient for most uses.

:mellow:

Thank you. I think I have figured out how I am going to do it.

Share this post


Link to post
Share on other sites
Darknvader500a

As PSalty said, one degree in latitude = 60nm. However the distance of a degree in Longitude will vary with how high you are above the equator. At the equator, it will be approx 60nm. At the poles, it will be approximately 0.

A quick gooley search found this:

Length of 1 degree of Longitude = cosine (latitude) * length of degree (miles) at equator from

http://www.colorado.edu/geography/gcraft/warmup/aquifer/html/distance.html

-Hope this helps

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.