Rapid Geographic Web Application Development with GeoDjango (Where 2.0 Tutorial - May 13, 2008)
geodjangoRapid Geographic Web Application with GeoDjangoMay 14, 2008Where 2.0…ƒ„†Django IntroInstallationThird-Party LibrariesInspection & Import‡ˆŠ‰ExplorationAdminMappingConclusionƒDjango Introgeodjango(Crazily brief) IntroductionDjango is a high-level Python web framework “that encourages rapid development and clean, pragmatic design.”More…http://toys.jacobian.org/presentations/2008/pycon/tutorial/http://www.djangoproject.com/documentation/design_philosophies/http://www.djangobook.com/en/1.0/chapter01/$ django‐admin.py startproject where2where2/__init__.pymanage.pysettings.pyurls.pyfrom django.db import modelsclass County(models.Model): name = models.CharField(...)>>> County(name=’x’).save()>>> County(name=’y’).save()>>> County.objects.count()2>>> c = County.objects.get(name=’y’)CREATE TABLE "app_county" ( "id" integer NOT NULL PRIMARY KEY, "name" varchar(50) NOT NULL );from django.contrib.gis.db \ import modelsfrom django.contrib.gis.geos \ import Pointclass County(models.Model): name = models.CharField(...) center = models.PointField(srid=4269) objects = models.GeoManager()>>> p1 = ’POINT (0 1)’>>> p2 = Point(10, 20)>>> County(name=’x’, center=p1).save()>>> County(name=’y’, center=p2).save()>>> County.objects.count()2>>> y = County.objects.get(center=p2)CREATE TABLE "app_county" ( "id" integer NOT NULL PRIMARY KEY, "name" varchar(50) NOT NULL, ) ...