GeoDjango + PostGIS Starter: Build a Simple Web GIS Backend
If you need a server-side data source for your web maps, GeoDjango + PostGIS is a dependable stack. You can serve GeoJSON to your front-end (Leaflet/OpenLayers) and still use TrueGIS for fast, client-side prints.
What you’ll build
- A Django project with GeoDjango enabled.
- A PostGIS database storing your geometries.
- A simple endpoint that returns GeoJSON features.
Key steps (high level)
- Install PostGIS and create a spatial database.
- Enable GeoDjango in your Django project (GDAL/GEOS required).
-
Create a model with
PointField
,LineStringField
, orPolygonField
. - Expose a view that serializes features to GeoJSON.
- Consume from the browser using OpenLayers or Leaflet.
Workflow with TrueGIS
Keep your authoritative data in PostGIS/GeoDjango; when you just need a clean print, draw annotations in TrueGIS and use Scaled Print for a quick, accurate export.
Related reading: Prepare GeoJSON for TrueGIS and Leaflet vs OpenLayers.