django-hydrosheds is a Django application for handling hydrosheds data.
Project description
A reusable Django application that provides ready-to-use GeoDjango models, REST API endpoints, serializers, and admin integration for the HydroSHEDS family of datasets:
HydroLAKES — global lake and reservoir polygons
HydroRIVERS — global river network line segments
HydroBASINS — global watershed / sub-basin boundaries
HydroWASTE — global wastewater treatment plant locations
Requirements
Python ≥ 3.12
Django ≥ 6.0
Runtime dependencies (installed automatically):
django-filter ≥ 25
djangorestframework ≥ 3.16
Runtime dependencies available for spatialite:
libspatialite-dev (Debian/Ubuntu)
spatialite-devel (Fedora/CentOS)
libspatialite (macOS)
libgdal-dev (Debian/Ubuntu)
libgeos-dev (Debian/Ubuntu)
libproj-dev (Debian/Ubuntu)
libsqlite3-mod-spatialite (Debian/Ubuntu)
libopenblas-dev (Debian/Ubuntu)
Installation
Install from PyPI:
pip install django-hydrosheds
Or via uv:
uv add django-hydrosheds
Quick Start
Add hydrosheds and its dependencies to INSTALLED_APPS:
INSTALLED_APPS = [
# ...
"django.contrib.gis",
"django_filters",
"rest_framework",
"hydrosheds",
]
Include the URL configuration in your project’s urls.py:
from django.urls import path, include
urlpatterns = [
# ...
path("api/", include("hydrosheds.urls")),
]
Run migrations:
python manage.py migrate
Models
All models live under hydrosheds.db and are backed by abstract base classes defined in hydrosheds.db.core. Each field carries descriptive help_text derived from the official HydroSHEDS technical documentation.
Concrete Model |
Abstract Base (core) |
Geometry |
|---|---|---|
HydroLake |
HydroLakePoint |
PointField |
HydroRiver |
HydroRiverLine |
LineStringField |
HydroBasin |
HydroBasinPolygon |
MultiPolygon |
HydroWaste |
HydroWastePoint |
PointField |
All geometry fields use SRID 4326 (WGS 84).
REST API
The package ships with ModelViewSet views registered through a DefaultRouter. Each endpoint supports filtering, search, and ordering out of the box via django-filter.
Endpoint |
ViewSet |
|---|---|
/HydroLakePoint |
HydroLakePointViewSet |
/HydroRiverLine |
HydroRiverLineViewSet |
/HydroWastePoint |
HydroWastePointViewSet |
/HydroBasinPolygon |
HydroBasinViewSet |
Permissions default to IsAuthenticatedOrReadOnly.
Management Command ‘geodata’
Download shapefiles from https://www.hydrosheds.org/products
Use the bundled management command to import shapefiles:
# load data to database table
python manage.py geodata -f path/to/HydroRIVERS_v10.shp -n HydroRiver --load
# print model classes and mappings
python manage.py geodata -f path/to/HydroRIVERS_v10.shp -n HydroRiver
# print help
python manage.py geodata -h
Configuration
The following Django settings are available:
- HYDROSHEDS_DISABLE_MODELS
Set to True to prevent model registration (useful in projects that only need the abstract base classes).
- HYDROSHEDS_DISABLE_ADMIN
Set to True to skip automatic admin site registration.
License
GPL-3.0 — see LICENSE for details.
Links
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_hydrosheds-1.0.2.tar.gz.
File metadata
- Download URL: django_hydrosheds-1.0.2.tar.gz
- Upload date:
- Size: 23.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
38d34c547fdd15145082f80a5c157a0522e519f5f77bf4ea212636d5a782f354
|
|
| MD5 |
1cc223f0832bedf462573cdcd93106b3
|
|
| BLAKE2b-256 |
d3f2b5dcb1d5ff04a6efb402244151faa259881e9110265b90b741f900d3d258
|
Provenance
The following attestation bundles were made for django_hydrosheds-1.0.2.tar.gz:
Publisher:
release.yaml on Groupeffect/django-hydrosheds
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_hydrosheds-1.0.2.tar.gz -
Subject digest:
38d34c547fdd15145082f80a5c157a0522e519f5f77bf4ea212636d5a782f354 - Sigstore transparency entry: 1182215575
- Sigstore integration time:
-
Permalink:
Groupeffect/django-hydrosheds@c47d9966f5ae8a23ed91931c94bfaf4e2b5eb242 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Groupeffect
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@c47d9966f5ae8a23ed91931c94bfaf4e2b5eb242 -
Trigger Event:
push
-
Statement type:
File details
Details for the file django_hydrosheds-1.0.2-py3-none-any.whl.
File metadata
- Download URL: django_hydrosheds-1.0.2-py3-none-any.whl
- Upload date:
- Size: 24.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c74bc815a7866d14bac3b7e6473c0e7de985ac196eb1c9cfd26b92297094cf00
|
|
| MD5 |
94380be2b99ec124277d2c20a5daae21
|
|
| BLAKE2b-256 |
ff32c01367ba4898c5a3fc3928cc67be6a2c6387e5065c01d7f8a9abcf66054b
|
Provenance
The following attestation bundles were made for django_hydrosheds-1.0.2-py3-none-any.whl:
Publisher:
release.yaml on Groupeffect/django-hydrosheds
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_hydrosheds-1.0.2-py3-none-any.whl -
Subject digest:
c74bc815a7866d14bac3b7e6473c0e7de985ac196eb1c9cfd26b92297094cf00 - Sigstore transparency entry: 1182215597
- Sigstore integration time:
-
Permalink:
Groupeffect/django-hydrosheds@c47d9966f5ae8a23ed91931c94bfaf4e2b5eb242 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Groupeffect
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@c47d9966f5ae8a23ed91931c94bfaf4e2b5eb242 -
Trigger Event:
push
-
Statement type: