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.1.tar.gz (23.4 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.1-py3-none-any.whl (24.6 kB view details)

Uploaded Python 3

File details

Details for the file django_hydrosheds-1.0.1.tar.gz.

File metadata

  • Download URL: django_hydrosheds-1.0.1.tar.gz
  • Upload date:
  • Size: 23.4 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.1.tar.gz
Algorithm Hash digest
SHA256 5611e5b6055ef86329b24030abe5c73341c89d1a18c0d641dfe80546d4655393
MD5 b71bb4276ea1ffb32cd4be474c807b32
BLAKE2b-256 05206f41b79e87a3ab5bb567261b15d18558f952856bdca63de25472a2561104

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_hydrosheds-1.0.1.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.1-py3-none-any.whl.

File metadata

File hashes

Hashes for django_hydrosheds-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f196a1c291451ac8aed96e1e89561284671bfb5faa17c69ee8eec7f87d5ccad0
MD5 1ceac807ccd0dae71a18392b2942c788
BLAKE2b-256 9e8bced66aa6fc9c0ad5d5c1dadd2516c899c81c60b31ab109ca603da5d096cf

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_hydrosheds-1.0.1-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