Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Introduction to GeoDjango

1,770 views

Published on

Published in: Technology
  • Be the first to comment

Introduction to GeoDjango

  1. 1. Introduction to GeoDjango David Wilson
  2. 2. An Outline: • Who am I? • What is GeoDjango? • A Tour of GeoDjango • Example: Colorado Geology
  3. 3. Who Am I?
  4. 4. Who Am I? ● Full time Java developer ● Love Python and the web ● Degree in Geophysics ● Some GIS background, actively working to improve knowledge ● Travel, weight lifting, cycling, and skiing
  5. 5. What is GeoDjango?
  6. 6. GeoDjango = spatial toolbox
  7. 7. Spatial?
  8. 8. Not Spatial
  9. 9. Spatial!
  10. 10. A Tour of GeoDjango
  11. 11. Tour: Backends
  12. 12. Tour: Backends Use this one!
  13. 13. Tour: Models from django.contrib.gis.db import models
  14. 14. Tour: Models
  15. 15. Tour: Model Fields ● GeometryField ● PointField ● LineStringField ● PolygonField ● MultiPointField ● MultiLineStringField ● MultiPolygonField ● GeometryCollectionField
  16. 16. Tour: GeoManager ● Overrides model manager ● Enables spatial queries ● Gotcha: required on models with no spatial fields that need to query related models spatially
  17. 17. Tour: GeoQuerySet ● Many spatial queries, e.g. ● contains ● crosses ● overlaps ● intersects ● Distance and area queries ● Gotcha: query availability varies based on backend
  18. 18. Tour: GeoQuerySet Use this one!
  19. 19. Tour: GEOS API • Geometry Engine – Open Source • Loosely coupled to GeoDjango • Allows for simple creation, manipulation, and transformation of geometries
  20. 20. Tour: GDAL API ● Geospatial Data Abstraction Library ● Reads spatial data: ● Shapefiles ● KML ● And many, many more! ● Easy to abstract data sources
  21. 21. Tour: GeoIP • Ctypes wrapper for MaxMind GeoIP • Requires appropriate local dataset • Allows server-side location • Generally not as accurate as HTML5 location API
  22. 22. Tour: GeoAdmin
  23. 23. Example: Colorado Geology
  24. 24. Example: Objectives • Find Colorado geology data • Import data • Query data (find rocks near you!) • Make a pretty map
  25. 25. Example: Finding Data
  26. 26. Example: Importing Data
  27. 27. Example: Importing Data
  28. 28. Example: View
  29. 29. Example: JavaScript
  30. 30. Example: More JavaScript
  31. 31. Example: Demo
  32. 32. Conclusions
  33. 33. Conclusions • Spatial toolbox • Use the parts you need • Built into the same Django you already own! • Will need to understand GIS basics • I hope to clean up this demo app and make a full tutorial
  34. 34. Resources Docs: https://docs.djangoproject.com/en/dev/ref/contrib/gis/ Vagrant image: https://github.com/david-wilson/vagrant-geodjango-base USGS Colorado Geology Data: http://mrdata.usgs.gov/geology/state/state.php?state=CO LeafletJS: http://leafletjs.com/ Contact Me: david@davidwilson.me, @dwilson86, http://davidwilson.me

×