22👍
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.
8👍
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.
- Clean Up HTML in Python
- Celery beat not picking up periodic tasks
- How to test (using unittest) the HTML output of a Django view?
- TimeField format in Django template
- Registered models do not show up in admin
5👍
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)
2👍
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.
- Is there any list of blog engines, written in Django?
- Django ALLOWED_HOSTS with ELB HealthCheck
- Django is very slow on my machine
- Django, Security and Settings
- Django's {{ csrf_token }} is outputting the token value only, without the hidden input markup