This is a small Django project I made to play around with OL-Cesium. It uses built-in Django authentication and has an index page. Styling is mostly done with Bootstrap 5.
Folder structure:
index/ - Django app for index page.
static/ - All static files (js, css, images).
tablemtnmap/ - Django app for Table Mountain 3D Trail Viewer
templates/ - Django templates (html) shared between apps (index and tablemtnmap also have their own).
theospatial/ - Django Project folder.
userprofile/ - Add some features to the Admin page, and a basic map with user location.
This app uses ol-cesium to create a 3D viewer of some popular hiking trails around Cape Town's iconic Table Mountain. I have worked with OpenLayers extensively but have never used Cesium or ol-cesium before and I was keen to try it out.
I built a small control that you can click on to fly to various hiking trails or return to the default view. When flying to a specific trail, it is highlighted in the colour shown on the control.
The zoom and North-up controls are the default ones from OpenLayers. I also added a help control from Cesium and changed the styling a bit so it matches the OpenLayers controls.
Data: Trails obtained from the OpenStreetMap roads layer as downloaded from BBBike. I cleaned it up a bit in QGIS and uploaded it to PostGIS. It is served through MapServer and MapCache as vector tiles (MVT). Satellite backdrop from Mapbox.
VM: Shared-CPU VM at Linode running Rocky Linux 9.
Webserver: Apache with mod_wsgi to run Django.
GIS Server: MapServer 8.0 and MapCache 1.14. MapServer was installed from EPEL 9 but MapCache had to be build from source (used RPMBuild to create an RPM file that can be installed with DNF - now hopefully it won't break when updating the system).
Database: PostgreSQL 15 with PostGIS 3.3 - installed from PGDG repos.
Domain: purchased from Domains.co.za.
Requires PostgreSQL and PostGIS. Python requirements are indicated in requirements.txt.
The settings setup is customised to allow for multiple deployments to be included in version control. Note that theospatial/settings/_init_.py is added to .gitignore - this file is used to store secrets (e.g. db user and password) and to select which settings file to use. For a new deployment:
- Copy _init_.template to _init_.py (don't rename).
- Add any secrets to this file (the template provides some guidance regarding db).
- Non-secret settings: copy theospatial/settings/dev.py, edit copy as necessary and change the import line in _init_.py to import from .mynewdev in stead of .dev