A high-performance, containerized Web Map Service (WMS) implementation for serving hillshade raster data. This service implements the OGC WMS 1.3.0 standard, providing capabilities for serving map images and metadata with support for efficient raster data handling.
Figure: Example output of the Hillshade WMS service
- OGC WMS 1.3.0 Compliance: Full support for standard WMS operations including GetCapabilities, GetMap, and GetFeatureInfo
- On-the-Fly Tile Generation: Generates map tiles dynamically for any requested extent and resolution without requiring pre-rendered tiles or disk caching
- Docker Support: Easy deployment using Docker
- Cloud-Optimized GeoTIFF (COG) Support: Built-in support for Cloud Optimized GeoTIFF format
- Dynamic CRS Handling: Automatic coordinate reference system detection and transformation
- Performance Optimized: Utilizes rasterio and numpy for fast image processing
- The input raster is a Cloud Optimized GeoTIFF (COG)
- The input raster is available at the specified path and not in an s3/minio bucket
- It is acceptable to generate the hillshade to the scope of the current window
- A colour ramp is not required for the generated tiles of either the hillshade or the elevation
- Docker and Docker Compose (for containerized deployment) or
- Python 3.13+
- GDAL (with development headers)
- pip (Python package manager)
The easiest way to run the WMS server is using Docker:
docker-compose up -dThe service will be available at http://localhost:8080/wms
Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows use `venv\Scripts\activate`Install system dependencies (Ubuntu/Debian example):
sudo apt-get update
sudo apt-get install -y python3-dev gcc gdal-bin libgdal-devInstall Python dependencies:
pip install -r requirements.txtConfiguration is handled through environment variables in the wms_server/settings.py file. Key configurations include:
WMS_RASTER_PATH: Path to the input raster file (default:data/sample.tif)DATA_DIR: Directory containing additional data files (default:data/)DEBUG: Enable debug mode (default:False)
The easiest way to start the server is using the provided start_server.sh script:
# Make the script executable if needed
chmod +x start_server.sh
# Start the server in development mode
./start_server.sh
# Or for production mode
./start_server.sh --productionAlternatively, you can start the server manually:
-
Development server:
python app.py
-
Production server with gunicorn:
# use this command or your preferred configuration gunicorn -w 4 -b 0.0.0.0:8080 app:app
The WMS service will be available at http://localhost:8080/wms
- Go to
Layers->Add Layer->Add WMS/WMTS Layer - Click on
Newto create a new WMS/WMTS server - Enter the URL of the WMS service -
http://localhost:8080/wms?service=WMS&version=1.3.0&request=GetCapabilities - Click on
OKto add the WMS/WMTS server - Click on
Connectto connect to the WMS/WMTS server - Select the layer
hillshadeand click onAddto add the layer to the map
Returns the WMS service metadata in XML format.
GET /wms?request=GetCapabilities&service=WMS&version=1.3.0
Returns a map image for the specified parameters.
GET /wms?request=GetMap&layers=hillshade&styles=&crs=EPSG:3857&bbox=<minx>,<miny>,<maxx>,<maxy>&width=<width>&height=<height>&format=image/png&transparent=true
Returns information about the feature at the specified location.
GET /wms?request=GetFeatureInfo&layers=hillshade&query_layers=hillshade&info_format=text/plain&x=<x>&y=<y>&width=<width>&height=<height>&bbox=<minx>,<miny>,<maxx>,<maxy>&crs=EPSG:3857
Run the test suite with:
pytest tests/This project uses pre-commit hooks for code quality. Install them with:
pre-commit installContributions to the Hillshade-WMS project are welcome!
- Follow the existing code style and formatting
- Write tests for new features and bug fixes(help needed)
- Update documentation as needed
- Ensure all tests pass before submitting a PR
- The application is set up with debug mode enabled by default.
- Any changes to Python files will automatically reload the server.
- The service includes built-in logging for monitoring and debugging.
- For production deployment, use the provided Dockerfile and docker-compose.yml for containerized deployment.
This project is licensed under the MIT License - see the LICENSE file for details.