Table of Contents for
Python Geospatial Development - Third Edition

Version ebook / Retour

Cover image for bash Cookbook, 2nd Edition Python Geospatial Development - Third Edition by Erik Westra Published by Packt Publishing, 2016
  1. Cover
  2. Table of Contents
  3. Python Geospatial Development Third Edition
  4. Python Geospatial Development Third Edition
  5. Credits
  6. About the Author
  7. About the Reviewer
  8. www.PacktPub.com
  9. Preface
  10. What you need for this book
  11. Who this book is for
  12. Conventions
  13. Reader feedback
  14. Customer support
  15. 1. Geospatial Development Using Python
  16. Geospatial development
  17. Applications of geospatial development
  18. Recent developments
  19. Summary
  20. 2. GIS
  21. GIS data formats
  22. Working with GIS data manually
  23. Summary
  24. 3. Python Libraries for Geospatial Development
  25. Dealing with projections
  26. Analyzing and manipulating Geospatial data
  27. Visualizing geospatial data
  28. Summary
  29. 4. Sources of Geospatial Data
  30. Sources of geospatial data in raster format
  31. Sources of other types of geospatial data
  32. Choosing your geospatial data source
  33. Summary
  34. 5. Working with Geospatial Data in Python
  35. Working with geospatial data
  36. Changing datums and projections
  37. Performing geospatial calculations
  38. Converting and standardizing units of geometry and distance
  39. Exercises
  40. Summary
  41. 6. Spatial Databases
  42. Spatial indexes
  43. Introducing PostGIS
  44. Setting up a database
  45. Using PostGIS
  46. Recommended best practices
  47. Summary
  48. 7. Using Python and Mapnik to Generate Maps
  49. Creating an example map
  50. Mapnik concepts
  51. Summary
  52. 8. Working with Spatial Data
  53. Designing and building the database
  54. Downloading and importing the data
  55. Implementing the DISTAL application
  56. Using DISTAL
  57. Summary
  58. 9. Improving the DISTAL Application
  59. Dealing with the scale problem
  60. Performance
  61. Summary
  62. 10. Tools for Web-based Geospatial Development
  63. A closer look at three specific tools and techniques
  64. Summary
  65. 11. Putting It All Together – a Complete Mapping System
  66. Designing the ShapeEditor
  67. Prerequisites
  68. Setting up the database
  69. Setting up the ShapeEditor project
  70. Defining the ShapeEditor's applications
  71. Creating the shared application
  72. Defining the data models
  73. Playing with the admin system
  74. Summary
  75. 12. ShapeEditor – Importing and Exporting Shapefiles
  76. Importing shapefiles
  77. Exporting shapefiles
  78. Summary
  79. 13. ShapeEditor – Selecting and Editing Features
  80. Editing features
  81. Adding features
  82. Deleting features
  83. Deleting shapefiles
  84. Using the ShapeEditor
  85. Further improvements and enhancements
  86. Summary
  87. Index

Chapter 11. Putting It All Together – a Complete Mapping System

In these final three chapters of this book, we will bring together all the topics discussed in previous chapters to implement a sophisticated web-based mapping application called ShapeEditor.

In this chapter, we will:

  • Look at the ShapeEditor system from the user's point of view in order to see how it will work
  • Look at the various parts of the ShapeEditor in depth and see how they will be implemented in terms of data structures and functionality
  • Set up a PostGIS database for the ShapeEditor to use
  • Create the GeoDjango project and applications for the ShapeEditor system
  • Define the ShapeEditor's database models
  • Configure the GeoDjango admin interface for the ShapeEditor
  • Use the admin interface to view and edit geospatial data within the ShapeEditor's database

About the ShapeEditor

As we have seen, shapefiles are commonly used to store, make available, and transfer geospatial data. We have worked with shapefiles extensively in this book, obtaining freely available geospatial data in Shapefile format, writing programs to load data from a shapefile, and creating shapefiles programmatically.

While it is easy enough to edit the attributes associated with a shapefile's features, editing the features themselves is a lot more complicated. One approach is to install a GIS system and use it to import the data, make changes, and then export the data into another shapefile. While this works, it is hardly convenient if all you want to do is make a few changes to a shapefile's features. It would be much easier if we had a web application specifically designed for editing shapefiles.

This is precisely what we are going to implement: a web-based shapefile editor. Rather unimaginatively, we'll call this program ShapeEditor.

The following flowchart depicts the ShapeEditor's basic workflow:

About the ShapeEditor

The user starts by importing a shapefile using the ShapeEditor's web interface, as shown in the following screen snapshot:

About the ShapeEditor

Tip

Our ShapeEditor implementation wasn't chosen for its good looks; instead, it concentrates on getting the features working. It would be easy to add stylesheets and edit the HTML templates to improve the appearance of the application, but doing so would make the code harder to understand. This is why we've taken such a minimalist approach to the user interface. Making it pretty is an exercise left to the reader.

Once the shapefile has been imported, the user can view the shapefile's features on a map and can select a feature by clicking on it. In this case, we have imported the World Borders Dataset, used several times in this book:

About the ShapeEditor

The user can then edit the selected feature's geometry as well as see a list of the attributes associated with that feature:

About the ShapeEditor

Once the user has finished making changes to the shapefile, he or she can export the shapefile again by clicking on the Export hyperlink on the main page:

About the ShapeEditor

That pretty much covers the ShapeEditor's functionality. It is a comparatively straightforward system, but it can be very useful if you need to work with geospatial data in shapefile format. And, of course, through the process of implementing the ShapeEditor, you will learn how to implement your own complex geospatial web applications using GeoDjango.