Your SlideShare is downloading. ×
0
GeoDjango &       HTML5 GeolocationJohn Paulett        john@paulett.orgSeptember 1, 2011       @johnpaulett
The PlanHTML5 GeolocationDjango Crash CourseWhat is GeoDjango?GeoDjango BasicsDemo Application
Geolocation
W3C GeolocationGPS, nearby Wi-Fi networks, cell towers, IPaddressIE 9, FF 3.6, Safari 5.0, Chrome, Opera 10.6, iOS,Android...
W3C Geolocationfunction showMap(position) {     console.log(position);}navigator.geolocation.getCurrentPosition(     showM...
W3C Geolocation{    "coords": {         "accuracy": 22000,         "altitude": null,         "altitudeAccuracy": null,    ...
Crash Course
models.pyfrom django.db import modelsclass City(models.Model):    name = models.TextField()class UserGroup(models.Model): ...
urls.pyurlpatterns = patterns(    url(         r^user-groups/(?P<city_name>w+)$,         myapp.views.user_groups    ),)
views.pydef user_groups(request, city_name): city = City.objects.get(name=city_name) groups = UserGroup.objects.filter(cit...
user_groups.html{% extends "base.html%}<ul>   {% for group in groups %}        <li>           {{ group.name }}        </li...
What is GeoDjango?“world-class geographic Web framework”included in Django coreCombine existing Python & DB tools withstan...
Some GIS ProblemsThe Earth is not a sphere!How to store & query efficiently  Vendor implementationsWide range of data form...
GeoDjango Basics
GeoDjango Model Fieldsfrom django.contrib.gis.db import modelsmodels.PointFieldmodels.LineStringFieldmodels.PolygonFieldmo...
Given a Set of Geo ObjectsMeasure & Find:  distance, area, perimeter, centroid, envelopeEdit:  transform (SRID), scaleOper...
Geo Queryingcontains, covers, crosses, disjoint, equals,intersects, touches, left/right, distance_lt,distance_gt …SalesReg...
lambdageo
lambdageo     http://lambdageo.ep.iohttp://github.com/johnpaulett/lambdageo
lambdageo.ep.io        ●models.pyAdminViewsTemplates
Django Admin
GIS is CoolPython GIS Tile Servers, Mapnik, etc.Data Openstreet Maps, Census
lambdageo.ep.iogithub.com/johnpaulett/lambdageojohn@paulett.org / @johnpaulett
References
ReferencesPython Geospatial Development – ErikWestra
Referenceshttp://geodjango.org/http://dev.w3.org/geo/api/spec-source.htmlhttp://src.chromium.org/viewvc/chrome/trunk/src/c...
GeoDjango & HTML5 Geolocation
GeoDjango & HTML5 Geolocation
Upcoming SlideShare
Loading in...5
×

GeoDjango & HTML5 Geolocation

4,809

Published on

Presentation at September 2011 Lambda Lounge.

Published in: Technology

Transcript of "GeoDjango & HTML5 Geolocation"

  1. 1. GeoDjango & HTML5 GeolocationJohn Paulett john@paulett.orgSeptember 1, 2011 @johnpaulett
  2. 2. The PlanHTML5 GeolocationDjango Crash CourseWhat is GeoDjango?GeoDjango BasicsDemo Application
  3. 3. Geolocation
  4. 4. W3C GeolocationGPS, nearby Wi-Fi networks, cell towers, IPaddressIE 9, FF 3.6, Safari 5.0, Chrome, Opera 10.6, iOS,Androidnavigator.geolocation.getCurrentPositionnavigator.geolocation.watchPosition
  5. 5. W3C Geolocationfunction showMap(position) { console.log(position);}navigator.geolocation.getCurrentPosition( showMap);
  6. 6. W3C Geolocation{ "coords": { "accuracy": 22000, "altitude": null, "altitudeAccuracy": null, "heading": null, "latitude": 38.631756, "longitude": -90.24323, "speed": null }, "timestamp": 1314459776275}
  7. 7. Crash Course
  8. 8. models.pyfrom django.db import modelsclass City(models.Model): name = models.TextField()class UserGroup(models.Model): name = models.TextField() city = models.ForeignKey(City) started = models.DateField() def join(self, user): # add user to group
  9. 9. urls.pyurlpatterns = patterns( url( r^user-groups/(?P<city_name>w+)$, myapp.views.user_groups ),)
  10. 10. views.pydef user_groups(request, city_name): city = City.objects.get(name=city_name) groups = UserGroup.objects.filter(city=city) return render(request, user_groups.html, {groups: groups})
  11. 11. user_groups.html{% extends "base.html%}<ul> {% for group in groups %} <li> {{ group.name }} </li> {% endfor %}</ul>
  12. 12. What is GeoDjango?“world-class geographic Web framework”included in Django coreCombine existing Python & DB tools withstandard APIbut first …
  13. 13. Some GIS ProblemsThe Earth is not a sphere!How to store & query efficiently Vendor implementationsWide range of data formats Tiger/LINE, Shapefiles, E00, OGR, GeoJSON, WKT, EWKT, EWKB, GML, KML, OSM, GLOBE, TIFF, ArcGrid ….
  14. 14. GeoDjango Basics
  15. 15. GeoDjango Model Fieldsfrom django.contrib.gis.db import modelsmodels.PointFieldmodels.LineStringFieldmodels.PolygonFieldmodels.MultiPointFieldmodels.MultiLineStringFieldmodels.MultiPolygonFieldmodels.GeometryCollectionField
  16. 16. Given a Set of Geo ObjectsMeasure & Find: distance, area, perimeter, centroid, envelopeEdit: transform (SRID), scaleOperations: intersection, difference, unionOutput: geojson, gml, kml, svgSalesRegion.objects.all().kml()
  17. 17. Geo Queryingcontains, covers, crosses, disjoint, equals,intersects, touches, left/right, distance_lt,distance_gt …SalesRegion.objects.filter( poly__distance_lt=(pnt, D(mi=500)))
  18. 18. lambdageo
  19. 19. lambdageo http://lambdageo.ep.iohttp://github.com/johnpaulett/lambdageo
  20. 20. lambdageo.ep.io ●models.pyAdminViewsTemplates
  21. 21. Django Admin
  22. 22. GIS is CoolPython GIS Tile Servers, Mapnik, etc.Data Openstreet Maps, Census
  23. 23. lambdageo.ep.iogithub.com/johnpaulett/lambdageojohn@paulett.org / @johnpaulett
  24. 24. References
  25. 25. ReferencesPython Geospatial Development – ErikWestra
  26. 26. Referenceshttp://geodjango.org/http://dev.w3.org/geo/api/spec-source.htmlhttp://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/geolocation/http://caniuse.com/#search=geolocation
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×