Skip to main content

An openlayers widget for Django with extended capabilities

Project description

django-extended-ol

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

  • Custom WMTS base_layer with fixed resolutions

Quick start

  1. Add "olwidget" to your INSTALLED_APPS setting like this:
INSTALLED_APPS = [
    ...,
    "olwidget",
]
  1. Configure olwidget 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
    }
}
  1. You can now use WMTSWidget in your gis forms:
gis_widget = WMTSWidget
  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)
  1. Start the development server and visit the admin.

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_extended_ol-0.1.0.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

django_extended_ol-0.1.0-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file django_extended_ol-0.1.0.tar.gz.

File metadata

  • Download URL: django_extended_ol-0.1.0.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.5

File hashes

Hashes for django_extended_ol-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b858b561082fd46b6dec7de981ca133da21d286f7f8c6748fff27c8b1424273c
MD5 f7128a3e1fa738b212b75d09b4f5ae13
BLAKE2b-256 562694c024ec48d4f013fea8d5c77699337e0dc764d8d81b9b0e782c1575fa4c

See more details on using hashes here.

File details

Details for the file django_extended_ol-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_extended_ol-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a10373d532359b02e8efa2e9d6da90a9dd252d1169b35ab384a607fe9bd85785
MD5 70d75a8f785a02f867b4fa59eb0e809c
BLAKE2b-256 60a8c40f365f844d296a8e5ab8a016549254bc81a47cc99360fd76ff91efc5cd

See more details on using hashes here.

Supported by

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