Selecting a feature to edit
As we discussed in the section on designing the ShapeEditor, GeoDjango's built-in map widgets can only display a single feature at a time. In order to display a map with all the shapefile's features on it, we will have to use OpenLayers directly, along with a Tile Map Server and a custom AJAX-based click handler. The basic workflow will look like this:
Let's start by implementing the Tile Map Server, and then see what's involved in using OpenLayers, along with a custom click-handler and some server-side AJAX code, to respond when the user clicks on the map.
Implementing Tile Map Server
As we discussed in Bonus chapter, Web Frameworks for Python Geospatial Development (Download link available in preface) the Tile Map Server Protocol is a simple RESTful protocol for serving map tiles. The TMS protocol includes calls to identify the various maps which can be displayed, along with information about the available map tiles, as well as providing access to the map tile...