GeoDjango
“Everything is related to everything else, but near things are more related than distant things.” - Tobler’s first law of geography
Example app - 3sqaure
from django.contrib.gis.db import models
class xyz(models.Model):
# ...
location = models.PointField()
objects = models.GeoManager
Create objects with shapes and points. Then can do stuff with querysets like:
Place.objects.filter(locations__within=london.shape).count()
gps_reading = Point(...)
Place.objects.all().distance(gps_reading).order_by('distance')
Place.objects.all().distance(gps_reading).order_by('distance')[0].geojson()
Many operations on shape - spacial relationships stuff.
Play with open datasets: