-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
148 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
"""Map Engine init, holds version""" | ||
|
||
__version__ = "1.7.0" | ||
__version__ = "1.8.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
In order to enable popups for your layers you have to define them in the settings using `MAP_ENGINE_POPUPS` parameter. | ||
For each layer in your map you can add a popup which is shown when clicking on the layer. | ||
To set up a popup for a layer you must use `Popup` dataclass from `django_mapengine.setup`. | ||
There you define to which layer the popup belongs. | ||
In order to enable popups for choropleths, which are layered over an existing layer (see section about [choropleths](./CHOROPLETHS.md)), | ||
you can use attribute `choropleths` to give a list of existing choropleths which should have popups. | ||
In order to deactivate popup for layer itself (enabled by default when setting up a popup), you must set `popup_at_default_layer=False`. | ||
|
||
NOTE: Order of popups defined under `MAP_ENGINE_POPUPS` matters! If two layers are overlapping, only first popup in list will show up. | ||
|
||
Once, popups are defined in settings, each time a user clicks on a layer and a popup event is fired, a backend call is made to | ||
`popup/<str:lookup>/<int:region>` holding the layer ID (or choropleth ID respectively) as `lookup` and clicked feature ID as `region`. | ||
Additionally, all parameters stored in frontend JS in variable `map_store.cold.state` are transferred to backend as well and can be received via `map_state = request.GET.dict()`. | ||
You can make use of this map state variable in your project in order to send additional information to backend, which can be used to customize popups depending on that information. | ||
|
||
From there, you can handle popup creation as you like, you only must return HTML at the end, which will be rendered within a popup modal. | ||
Nevertheless, you could use base classes from `django_mapengine.popups` as a starting point for your popups, which are holding basic functionality for | ||
initializing parameters and are offering a simple template system. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "django-mapengine" | ||
version = "1.7.0" | ||
version = "1.8.0" | ||
description = "Map engine for maplibre in django" | ||
authors = ["Hendrik Huyskens <[email protected]>"] | ||
readme = "README.md" | ||
|
@@ -29,6 +29,7 @@ isort = "^5.12.0" | |
flake8 = "^7.0.0" | ||
pylint = "^3.0.3" | ||
pylint-django = "^2.5.5" | ||
pytest = "^8.2.1" | ||
|
||
[build-system] | ||
requires = ["poetry-core"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters