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.
Features:
- Custom WMTS base_layer with fixed resolutions
Quick start
pip install django-extended-ol
- Add "django_extended_ol" to your INSTALLED_APPS setting like this:
INSTALLED_APPS = [
...,
"django_extended_ol",
]
- 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
}
}
- You can now use WMTSWidget in your gis forms:
from django_extended_ol.forms.widgets import WMTSWidget
...
class MyCustomGISClass:
gis_widget = WMTSWidget
- 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)
- Start the development server and visit the admin.
Build this package
py -m build
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file django_extended_ol-1.0.0.tar.gz
.
File metadata
- Download URL: django_extended_ol-1.0.0.tar.gz
- Upload date:
- Size: 6.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 588edc02c23b1d5b6dbd121db3512f8e65b301a9a98e5e5b09c04910aa1d6572 |
|
MD5 | c2ea320bc7aa2f18bf8b7f41e9042417 |
|
BLAKE2b-256 | 9b971614b9aa0153b530631eee48f315420fe5802aa89753420f1b94cb95d10d |
File details
Details for the file django_extended_ol-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: django_extended_ol-1.0.0-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c696802f54c344ecf79531945abf7a569523991eed093c1dec40618625193c0f |
|
MD5 | e087d418d60572b1395153db81ecb47d |
|
BLAKE2b-256 | 23c69f93bcd865e614f48dc63caeebb8156ee2ccc8d43ec75fbda03f6602fc0d |