Skip to main content

django-extended-ol

django-extended-ol is a Django app that extends the basic OpenLayers Widget.

Features:

  • Custom WMTS base_layer with fixed resolutions
  • Search on the map (third-party service needed)

Quick start

pip install django-extended-ol
  1. Add "django_extended_ol" to your INSTALLED_APPS setting like this:
INSTALLED_APPS = [
    ...,
    "django_extended_ol",
]
  1. Configure django_extended_ol in your settings.py, here's an example:
OLWIDGET = {
    "globals": {
        "srid": 2056,
        "default_center": [2551470, 1211190], # optional
        "default_resolution": 18, # optional
        "extent": [2420000, 1030000, 2900000, 1360000],
        "resolutions": [250, 100, 50, 20, 10, 5, 2.5, 2, 1.5, 1, 0.5, 0.25, 0.125, 0.0625]
    },
    "wmts": {
        "layer_name": 'plan_cadastral',
        "style": 'default',
        "matrix_set": 'EPSG2056',
        "attributions": '<a target="new" href="https://sitn.ne.ch/web/conditions_utilisation/contrat_SITN_MO.htm'
            + '">© SITN</a>', # optional
        "url_template": 'https://sitn.ne.ch/mapproxy95/wmts/1.0.0/{layer}/{style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.png',
        "request_encoding": 'REST', # optional
        "format": 'image/png' # optional
    },
    "vector": { # optional, only if you want to override the default style
        "fill_color": "rgba(255, 255, 255, 0.2)",
        "stroke_color": "yellow",
        "stroke_width": 2,
        "circle_radius": 7,
        "circle_fill_color": "yellow"
    },
    "search": { # optional, only if you want a search service
        "url_template": 'https://sitn.ne.ch/search?limit=10&partitionlimit=2&interface=desktop&query={search_term}'
    }
}
  1. You can now use WMTSWidget in your gis forms:
from django_extended_ol.forms.widgets import WMTSWidget
...
class MyCustomGISClass:
    gis_widget = WMTSWidget

Note that CSS is not provided by default, you have to give your map a height like:

    .dj_map {
        height: 400px;
    }

If you want a search widget, you can use WMTSWithSearchWidget. Please check search service specification below.

  1. You can also use it in your admin.py:
from django.contrib.gis import admin
from .models import YourGeomModel
from olwidget.admin import WMTSGISModelAdmin

admin.site.register(YourGeomModel, WMTSGISModelAdmin)

If you want the search widget please use WMTSGISWithSearchModelAdmin. Please check search service specification below.

  1. Start the development server and visit the admin.

Search service specification

You'll need a templated URL as showcased in the settings.py above. Such service should reply GeoJSON feature collection and each feature should have a bbox and a property named label.

Metadata

Release files for django-extended-ol 1.2.2

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-extended-ol 1.2.2
File Size Uploaded Provenance Actions
django_extended_ol-1.2.2.tar.gz 8.8 kB Without provenance Details for django_extended_ol-1.2.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-extended-ol 1.2.2
File Interpreter ABI Platform Actions
django_extended_ol-1.2.2-py3-none-any.whl Python 3 none any Details for django_extended_ol-1.2.2-py3-none-any.whl

Total release size: 17.5 kB

Release files / django_extended_ol-1.2.2.tar.gz

Download URL django_extended_ol-1.2.2.tar.gz
Size 8.8 kB
Tags Source
SHA-256 checksum
How to use checksums
82aabce59345512de967ba84b5b5c4b2448dbc40bbd63396583ee14d0b15e8b2
BLAKE2b-256 checksum
How to use checksums
41fa164d80048fd0c20a6d3e7db93989c1ebeb294006f7903db606ae50d3662f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / django_extended_ol-1.2.2-py3-none-any.whl

Download URL django_extended_ol-1.2.2-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9ab2c3105e28e7b694b178dfdf88bc0098128d4437fc59ded6f1aea12c4c2088
BLAKE2b-256 checksum
How to use checksums
1c44488cc22598a82e28afcbf0e6660a640c0f7a43ee2e8b0785acc278e5e27b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Security for django-extended-ol 1.2.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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