[Fixed]-How do I convert kilometres to degrees in Geodjango/GEOS?


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.


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.



The buffer in the GEOS django API will create a buffer using whatever units your current co-ordinate system uses.

If you’re storing everything in 4326 (in lat/long degrees) then you will have to find some tricky way of converting KM to degrees. But now your buffer will get severely distorted the more north you go.

A better solution is to re-project your geometry into a projection that maintains area, and often that kind of projection can track units in meters.

For example, if you are creating buffered areas in North America, you can use this projection which uses meters http://spatialreference.org/ref/sr-org/7314/

Here is an example of how to do that using Django GEOS API:

    from django.contrib.gis.geos import Point

    # Defines a point in lat/long
    p = Point(-70, 50) 

    # This projection defines lat/long coordinate system
    p.srid = 4326 

    # Transform into the 7314 projection using the OGC WKT format to define that projection
    p.transform('PROJCS["NA Lambert Azimuthal Equal Area",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["degree",0.0174532925199433]],PROJECTION["Lambert_Azimuthal_Equal_Area"],PARAMETER["false_easting",0.0],PARAMETER["false_northing",0.0],PARAMETER["longitude_of_center",-100.0],PARAMETER["latitude_of_center",45.0],UNIT["meter",1.0]]')

    # Creates a buffered polygon of 1000 meters in radius
    poly = p.buffer(1000)


distance = degree * PI * diameter / 360

Using a rough estimate of the radius of the earth: 6378 km

1 Degree @ at the Equator or along the longitude is: 111.317 km

1 Degree along a latitude at x degree latutide is:
(degrees * PI * diameter / 360) * cos (latitude)

So @ 60 latitude:
55 659 m in the longitude direction.

Leave a comment