Skip to main content

django-ogcapif

WARNING This is in under development. API will break. Do not use in production.

django-ogcapif allows to easily expose your Django models through an OGCAPI-Features endpoint. It is based on Django REST Framework.

Quickstart

# copy default conf
cp .env.example .env

# start the stack
docker compose up --build -d

# deploy static files and migrate database
docker compose exec django python manage.py collectstatic --no-input
docker compose exec django python manage.py migrate --no-input

# A convenience start-up Django command is there to populate the database with testdata for each app:
docker compose exec django python manage.py populate_vl
docker compose exec django python manage.py populate_signs_poles
docker compose exec django python manage.py populate_edge_cases

# Wait a little, then check that https://localhost/oapif/collections/signalo_core.pole/items works from your browser

Tests

To run all tests, launch the Compose application as shown in the Quickstart. Then run

docker compose exec django python manage.py test

Authentication & permissions

By default the viewsets under signalo/core use the DjangoModelPermissionsOrAnonReadOnly permissions class. You can add model permissions when registering their corresponding viewsets, as permission_classes. (Refer to https://www.django-rest-framework.org/api-guide/permissions/#api-reference for permission classes). Example:

# models.py
# ----------
from rest_framework import permissions
from django.contrib.gis.db import models
from django_oapif.decorators import register_oapif_viewset

@register_oapif_viewset(
    custom_viewset_attrs={
        "permission_classes": (permissions.DjangoModelPermissionsOrAnonReadOnly,)
    }
)
class MyModel(models.Model):
    ...

Use from QGIS

Once up and running, you can use it from QGIS like this:

  • Go to Layers > Add layer > Add WFS Layer...
  • Create a new connection
    • URL: https://localhost/oapif/
    • Version: OGC API - Features
  • Click OK and ignore choose to ignore the invalid certificate error and store the exception
  • You should see the two layers in the list, select them and choose add.

Run tests

You can run the OGC API conformance test suite like this:

docker compose run conformance_test

Results will be stored to `_test_outputs\testng...\emailable-report.html

Metadata

Release files for django-ogcapif 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-ogcapif 0.1.6
File Size Uploaded
django-ogcapif-0.1.6.tar.gz 10.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-ogcapif 0.1.6
File Interpreter ABI Platform
django_ogcapif-0.1.6-py3-none-any.whl Python 3 none any Details

Total release size: 22.5 kB

Release files / django-ogcapif-0.1.6.tar.gz

Download URL django-ogcapif-0.1.6.tar.gz
Size 10.7 kB
Tags Source
SHA-256 checksum
How to use checksums
0e6fa7f97bcc229eecf4a9ecf1ae96b9f229d6779c94d612e1ce38fddd32bbe4
BLAKE2b-256 checksum
How to use checksums
c1ed56994fda58fe848cdfe9d60eb81a928cccca78c9e4bb427517f2db430d3b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Release files / django_ogcapif-0.1.6-py3-none-any.whl

Download URL django_ogcapif-0.1.6-py3-none-any.whl
Size 11.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4c377b842131fba6664ad4351664c18442814235a482822fc1cb2a3d9f96999b
BLAKE2b-256 checksum
How to use checksums
bfc4fe30dc14288c760b591e1e7cc372635451a6af1aade9ecf949c3562645c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Release history Release notifications | RSS feed

This release

0.1.6 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page