Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I convert kilometres to degrees in Geodjango/GEOS?

I'm using the "buffer" method from the GEOS API to create a circle based on a point and a radius in GeoDjango, according to this answer: GeoDjango: How to create a circle based on point and radius

As one commenter noted, you'll have to convert the radius in km to degrees... but how? I guess it's a quick formula but it's greek to me. I'd be grateful for any pointers.

like image 215
Jonas Avatar asked Mar 07 '11 08:03

Jonas


People also ask

How do you convert km to degrees?

Near the equator, 1km is going to equal roughly 0.008 degrees (1 km / 40,000 km * 360 degrees) of latitude and longitude, but near the poles, 1km is going to equal roughly 0.008 degrees latitude, but could be many many degrees longitude.

How many km is a degree of longitude?

A degree of longitude is about 111 kilometers (69 miles) at its widest. The widest areas of longitude are near the Equator, where Earth bulges out. Because of Earth's curvature, the actual distance of a degrees, minutes, and seconds of longitude depends on its distance from the Equator.

How many km is 0.5 degrees?

Since one degree (1°) near the equator is equivalent to about 111 km, either moving to south or north poles of both the longitude and the latitude, though slight difference of about 1km. Therefore, 0.25° by 0.25° gridded degree is equivalent to about 27.75 km, while 0.5° by 0.5° is about 55km.


2 Answers

1 deg lat is approx 110.567 km at the equator to 111.699 km at the poles.

This link might be of interest to you. The conversion is based on the circumference of the earth divide by 360 degrees.

1 deg long is also approx 111km at the equator and -> 0 as you go to the poles.

like image 29
dting Avatar answered Sep 20 '22 04:09

dting


The answer may depend upon location on earth. Near the equator, 1km is going to equal roughly 0.008 degrees (1 km / 40,000 km * 360 degrees) of latitude and longitude, but near the poles, 1km is going to equal roughly 0.008 degrees latitude, but could be many many degrees longitude. (If you're 1km away from the pole, 1km travel 'west' would bring you roughly 57 degrees of longitude west.)

But, if the API just wants degrees along a great circle as the measurement, perhaps it'd be sufficient to use (n km / 40,000 km * 360 degrees). At least, 40,000km is "good enough for me" :) more accurate numbers are available.

like image 63
sarnold Avatar answered Sep 22 '22 04:09

sarnold