How it works...

You created an HTML front page for the web application you developed in the previous recipe. The HTML is dynamically created using the Django template language (https://docs.djangoproject.com/en/dev/topics/templates/) and the map was implemented with the Leaflet JavaScript library.

The Django template language uses the response from the home view to generate a list of all of the sightings in the system.

The map was created using Leaflet. First, an OpenStreetMap layer was used as a base map. Then, using jQuery, you fed a GeoJSON layer that displays all of the features generated by the get_geojson view. You associated a popup with the layer that opens every time the user clicks on a sighting entity. The popup displays the main ...

Get PostGIS Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.