Be seen. Boost your question’s priority for more expert views and faster solutions

Dear Experts

Is it possible to come up with some sort of formula which can find all possible longitude and latitude co-ordinates within a circle when given the center of a circle. The circle has a radius of 0.05 Miles. The center point is given in longitude and latitude co-ordinates also.

Thanks

Is it possible to come up with some sort of formula which can find all possible longitude and latitude co-ordinates within a circle when given the center of a circle. The circle has a radius of 0.05 Miles. The center point is given in longitude and latitude co-ordinates also.

Thanks

Experts Exchange Solution brought to you by

Enjoy your complimentary solution view.

Get every solution instantly with Premium.
Start your 7-day free trial.

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

http://williams.best.vwh.net/avform.htm#Dist

For short distances like 0.05 Miles, not too close to the poles,

a reasonable approximation could be

(x - x0)² + ((y - y0)/cos(x))² <= R²

Although, 0.05 miles is a very small radius, and the difference between the true distance on the Earth's surface and the approximated distance sqrt((x-x0)² + (y-y0)²) will be very small.

Sentence continued : ... will be very small on that scale.

on any scale (y-y0) should still be adjusted by a factor of cos(x)

(x - x0)² + ((y - y0)/cos(x))² <= R² should have been

(x - x0)² + ((y - y0)*cos(x))² <= R²

assuming y is longitude and x is latitude

I mean an actual circle drawn on the map using a compass. It was probably the wrong interpretation anyway :)

On a Mercator map, (x - x0)² + (y - y0)² still only works near the equator, since the latitude scale gets distorted away from the equator.

Mm ... I see what you mean now. And I stand corrected.

I have a list of some co-ordinates in longitude and latitude, and basically I need to know if they fit into the circle.

>> I mean an actual circle drawn on the map using a compass. It was probably the wrong interpretation anyway :)

I was hoping for a formular which was more accurate, i.e. takes into account the curvature of the planet

>> (x - x0)² + ((y - y0)*cos(x))² might still be ok if you're more than 3000 miles from a pole.

What happens if the center of the circle is closer to the poles. What formular would be needed then?

Yep ... ozo's posts should help you better than mine :)

>> http://www.movable-type.co.uk/scripts/gis-faq-5.1.html

>> Yep ... ozo's posts should help you better than mine :)

I went to those links and just wanted to confirm if this is what I am after?...

Lat/lon given radial and distance

A point {lat,lon} is a distance d out on the tc radial from point 1 if:

lat=asin(sin(lat1)*cos(d)+

IF (cos(lat)=0)

lon=lon1 // endpoint a pole

ELSE

lon=mod(lon1-asin(sin(tc)*

ENDIF

#################

specifically this part

This algorithm is limited to distances such that dlon <pi/2, i.e those that extend around less than one quarter of the circumference of the earth in longitude. A completely general, but more complicated algorithm is necessary if greater distances are allowed:

lat =asin(sin(lat1)*cos(d)+cos

dlon=atan2(sin(tc)*sin(d)*

lon=mod( lon1-dlon +pi,2*pi )-pi

How accurate is this when more than 3000 miles from the poles to less than 3000 miles from the poles?

The less general algorithm works for when you are dealing with distances < d when you are > d from the poles.

lat =asin(sin(lat1)*cos(d)+cos

dlon=atan2(sin(tc)*sin(d)*

lon=mod( lon1-dlon +pi,2*pi )-pi

anywhere

you can use

lat=asin(sin(lat1)*cos(d)+

IF (cos(lat)=0)

lon=lon1 // endpoint a pole

ELSE

lon=mod(lon1-asin(sin(tc)*

ENDIF

for d<3000 miles when more than 3000 miles from the poles

or for d<30 miles when more than 30 miles from the poles

or for d<0.05 miles when more than 0.05miles from the poles

So how do I apply this if I have the center point here:

lat:41.902277040963696

lng:-99.84375

with a radius of 5 miles

using the following formula:

lat =asin(sin(lat1)*cos(d)+cos

dlon=atan2(sin(tc)*sin(d)*

lon=mod( lon1-dlon +pi,2*pi )-pi

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Math / Science

From novice to tech pro — start learning today.

Experts Exchange Solution brought to you by

Enjoy your complimentary solution view.

Get every solution instantly with Premium.
Start your 7-day free trial.

There are infinitely many (and uncountable on top of that), so no.

Maybe you should specify why you need this ...

All points (x, y) in a circle with center (x0, y0) and radius R make these true :

(x - x0)² + (y - y0)² <= R²