Skip to main content

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

  1. Add hydrosheds and its dependencies to INSTALLED_APPS:

INSTALLED_APPS = [
    # ...
    "django.contrib.gis",
    "django_filters",
    "rest_framework",
    "hydrosheds",
]
  1. Include the URL configuration in your project’s urls.py:

from django.urls import path, include

urlpatterns = [
    # ...
    path("api/", include("hydrosheds.urls")),
]
  1. 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_hydrosheds-1.0.2.tar.gz (23.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_hydrosheds-1.0.2-py3-none-any.whl (24.6 kB view details)

Uploaded Python 3

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

Hashes for django_hydrosheds-1.0.2.tar.gz
Algorithm Hash digest
SHA256 38d34c547fdd15145082f80a5c157a0522e519f5f77bf4ea212636d5a782f354
MD5 1cc223f0832bedf462573cdcd93106b3
BLAKE2b-256 d3f2b5dcb1d5ff04a6efb402244151faa259881e9110265b90b741f900d3d258

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_hydrosheds-1.0.2.tar.gz:

Publisher: release.yaml on Groupeffect/django-hydrosheds

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file django_hydrosheds-1.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for django_hydrosheds-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c74bc815a7866d14bac3b7e6473c0e7de985ac196eb1c9cfd26b92297094cf00
MD5 94380be2b99ec124277d2c20a5daae21
BLAKE2b-256 ff32c01367ba4898c5a3fc3928cc67be6a2c6387e5065c01d7f8a9abcf66054b

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_hydrosheds-1.0.2-py3-none-any.whl:

Publisher: release.yaml on Groupeffect/django-hydrosheds

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page