ckanext-versioned-tiledmap 2.3.2__tar.gz → 2.3.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ckanext_versioned_tiledmap-2.3.2/ckanext_versioned_tiledmap.egg-info → ckanext_versioned_tiledmap-2.3.4}/PKG-INFO +10 -5
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/README.md +6 -2
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/lib/helpers.py +5 -4
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/lib/utils.py +4 -3
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/lib/validators.py +5 -4
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/plugin.py +7 -4
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/routes/_helpers.py +20 -17
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/routes/map.py +1 -1
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/theme/assets/less/maps.less +8 -2
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4/ckanext_versioned_tiledmap.egg-info}/PKG-INFO +10 -5
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext_versioned_tiledmap.egg-info/requires.txt +1 -1
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/docs/_scripts/gen_api_pages.py +0 -1
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/pyproject.toml +31 -10
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/tests/test_helpers.py +1 -1
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/tests/test_route_helpers.py +1 -1
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/tests/test_utils.py +2 -1
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/tests/test_validators.py +3 -1
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/LICENSE +0 -0
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/__init__.py +0 -0
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/__init__.py +0 -0
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/config.py +0 -0
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/lib/__init__.py +0 -0
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/routes/__init__.py +0 -0
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/theme/assets/scripts/ckanfilterurl.js +0 -0
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/theme/assets/scripts/drawshape_control.js +0 -0
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/theme/assets/scripts/fullscreen_control.js +0 -0
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/theme/assets/scripts/map_view.js +0 -0
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/theme/assets/scripts/maptype_control.js +0 -0
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/theme/assets/scripts/minimap_control.js +0 -0
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/theme/assets/scripts/pointinfo_plugin.js +0 -0
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/theme/assets/scripts/sidebar_view.js +0 -0
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/theme/assets/scripts/tiledmap_module.js +0 -0
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/theme/assets/scripts/tooltip_plugin.js +0 -0
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/theme/assets/vendor/backbone/1.0.0/backbone.js +0 -0
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/theme/assets/vendor/jquery/1.7.1/jquery.js +0 -0
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/theme/assets/vendor/jquery/1.7.1/jquery.min.js +0 -0
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/theme/assets/vendor/leaflet/leaflet-src.js +0 -0
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/theme/assets/vendor/leaflet/leaflet.css +0 -0
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/theme/assets/vendor/leaflet/leaflet.js +0 -0
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/theme/assets/vendor/leaflet.draw/leaflet.draw-src.js +0 -0
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/theme/assets/vendor/leaflet.draw/leaflet.draw.css +0 -0
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/theme/assets/vendor/leaflet.minimap/Control.MiniMap.css +0 -0
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/theme/assets/vendor/leaflet.minimap/Control.MiniMap.js +0 -0
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/theme/assets/vendor/leaflet.minimap/LICENSE.txt +0 -0
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/theme/assets/vendor/leaflet.minimap/readme.md +0 -0
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/theme/assets/vendor/leaflet.utfgrid/leaflet.utfgrid.js +0 -0
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/theme/assets/vendor/leaflet.utfgrid/leaflet.utfgrid.queue.js +0 -0
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/theme/assets/vendor/mustache/0.5.0-dev/mustache.js +0 -0
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/theme/assets/vendor/mustache/0.5.0-dev/mustache.min.js +0 -0
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/theme/assets/vendor/terraformer/terraformer-wkt-parser.js +0 -0
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/theme/assets/vendor/terraformer/terraformer.js +0 -0
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/theme/assets/vendor/underscore/1.4.2/underscore.js +0 -0
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/theme/assets/vendor/underscore/1.4.2/underscore.min.js +0 -0
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/theme/assets/webassets.yml +0 -0
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/theme/public/data/countries.geojson +0 -0
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/theme/public/vendor/leaflet/leaflet/layers-2x.png +0 -0
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/theme/public/vendor/leaflet/leaflet/layers.png +0 -0
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/theme/public/vendor/leaflet/leaflet/marker-icon-2x.png +0 -0
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/theme/public/vendor/leaflet/leaflet/marker-icon.png +0 -0
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/theme/public/vendor/leaflet/leaflet/marker-shadow.png +0 -0
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/theme/public/vendor/leaflet/leaflet.draw/spritesheet-2x.png +0 -0
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/theme/public/vendor/leaflet/leaflet.draw/spritesheet.png +0 -0
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/theme/public/vendor/leaflet/leaflet.minimap/toggle.png +0 -0
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/theme/templates/map_form.html +0 -0
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/theme/templates/map_view.html +0 -0
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/theme/templates/point_detail.dwc.mustache +0 -0
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/theme/templates/point_detail.mustache +0 -0
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/theme/templates/point_detail_hover.dwc.mustache +0 -0
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/theme/templates/point_detail_hover.mustache +0 -0
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext_versioned_tiledmap.egg-info/SOURCES.txt +0 -0
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext_versioned_tiledmap.egg-info/dependency_links.txt +0 -0
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext_versioned_tiledmap.egg-info/entry_points.txt +0 -0
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext_versioned_tiledmap.egg-info/not-zip-safe +0 -0
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext_versioned_tiledmap.egg-info/top_level.txt +0 -0
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/setup.cfg +0 -0
- {ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: ckanext-versioned-tiledmap
|
|
3
|
-
Version: 2.3.
|
|
3
|
+
Version: 2.3.4
|
|
4
4
|
Summary: A CKAN extension with a map view for versioned-datastore backed resources.
|
|
5
5
|
Author-email: Natural History Museum <data@nhm.ac.uk>
|
|
6
6
|
License: GPL-3.0-or-later
|
|
@@ -18,20 +18,25 @@ Requires-Python: >=3.6
|
|
|
18
18
|
Description-Content-Type: text/markdown
|
|
19
19
|
License-File: LICENSE
|
|
20
20
|
Requires-Dist: ckanext-versioned-datastore>=3.7.0
|
|
21
|
-
Requires-Dist: ckantools>=0.3.0
|
|
22
21
|
Requires-Dist: cachetools>=4.2.4
|
|
22
|
+
Requires-Dist: ckantools>=0.4.2
|
|
23
23
|
Provides-Extra: test
|
|
24
24
|
Requires-Dist: mock; extra == "test"
|
|
25
25
|
Requires-Dist: pytest>=4.6.5; extra == "test"
|
|
26
26
|
Requires-Dist: pytest-cov>=2.7.1; extra == "test"
|
|
27
27
|
Requires-Dist: coveralls; extra == "test"
|
|
28
|
+
Dynamic: license-file
|
|
28
29
|
|
|
29
30
|
<!--header-start-->
|
|
30
|
-
<
|
|
31
|
+
<picture>
|
|
32
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://data.nhm.ac.uk/images/nhm_logo.svg">
|
|
33
|
+
<source media="(prefers-color-scheme: light)" srcset="https://data.nhm.ac.uk/images/nhm_logo_black.svg">
|
|
34
|
+
<img alt="The Natural History Museum logo." src="https://data.nhm.ac.uk/images/nhm_logo_black.svg" align="left" width="150px" height="100px" hspace="40">
|
|
35
|
+
</picture>
|
|
31
36
|
|
|
32
37
|
# ckanext-versioned-tiledmap
|
|
33
38
|
|
|
34
|
-
[](https://github.com/NaturalHistoryMuseum/ckanext-versioned-tiledmap/actions/workflows/tests.yml)
|
|
35
40
|
[](https://coveralls.io/github/NaturalHistoryMuseum/ckanext-versioned-tiledmap)
|
|
36
41
|
[](https://github.com/ckan/ckan)
|
|
37
42
|
[](https://www.python.org/)
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
<!--header-start-->
|
|
2
|
-
<
|
|
2
|
+
<picture>
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://data.nhm.ac.uk/images/nhm_logo.svg">
|
|
4
|
+
<source media="(prefers-color-scheme: light)" srcset="https://data.nhm.ac.uk/images/nhm_logo_black.svg">
|
|
5
|
+
<img alt="The Natural History Museum logo." src="https://data.nhm.ac.uk/images/nhm_logo_black.svg" align="left" width="150px" height="100px" hspace="40">
|
|
6
|
+
</picture>
|
|
3
7
|
|
|
4
8
|
# ckanext-versioned-tiledmap
|
|
5
9
|
|
|
6
|
-
[](https://github.com/NaturalHistoryMuseum/ckanext-versioned-tiledmap/actions/workflows/tests.yml)
|
|
7
11
|
[](https://coveralls.io/github/NaturalHistoryMuseum/ckanext-versioned-tiledmap)
|
|
8
12
|
[](https://github.com/ckan/ckan)
|
|
9
13
|
[](https://www.python.org/)
|
|
@@ -12,11 +12,12 @@ def mustache_wrapper(s):
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
def dwc_field_title(field):
|
|
15
|
-
|
|
15
|
+
"""
|
|
16
16
|
Convert a DwC field name into a label - split on uppercase
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
|
|
18
|
+
:param field:
|
|
19
|
+
:returns: str label
|
|
20
|
+
"""
|
|
20
21
|
title = re.sub('([A-Z]+)', r' \1', field)
|
|
21
22
|
title = f'{title[0].upper()}{title[1:]}'
|
|
22
23
|
return title
|
{ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/lib/utils.py
RENAMED
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
# This file is part of a project
|
|
5
5
|
# Created by the Natural History Museum in London, UK
|
|
6
6
|
|
|
7
|
-
from ckan.plugins import toolkit
|
|
8
7
|
import urllib.request
|
|
9
|
-
|
|
8
|
+
|
|
9
|
+
from cachetools import TTLCache, cached
|
|
10
|
+
from ckan.plugins import toolkit
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
def get_resource_datastore_fields(resource_id):
|
|
@@ -32,4 +33,4 @@ def get_tileserver_status():
|
|
|
32
33
|
else:
|
|
33
34
|
tileserver_response_text = 'unavailable'
|
|
34
35
|
|
|
35
|
-
return tileserver_response_text
|
|
36
|
+
return tileserver_response_text
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import re
|
|
8
8
|
|
|
9
9
|
from ckan.plugins import toolkit
|
|
10
|
+
|
|
10
11
|
from ckanext.tiledmap.lib.utils import get_resource_datastore_fields
|
|
11
12
|
|
|
12
13
|
|
|
@@ -16,7 +17,7 @@ def colour_validator(value, context):
|
|
|
16
17
|
|
|
17
18
|
:param value: the value to validate
|
|
18
19
|
:param context: the context within which this validation is taking place
|
|
19
|
-
:
|
|
20
|
+
:returns: the validated value
|
|
20
21
|
"""
|
|
21
22
|
if re.match('^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$', value):
|
|
22
23
|
if value[0] != '#':
|
|
@@ -38,7 +39,7 @@ def float_01_validator(value, context):
|
|
|
38
39
|
|
|
39
40
|
:param value: the value
|
|
40
41
|
:param context: the context within which this validation is taking place
|
|
41
|
-
:
|
|
42
|
+
:returns: the validated value
|
|
42
43
|
"""
|
|
43
44
|
try:
|
|
44
45
|
value = float(value)
|
|
@@ -55,7 +56,7 @@ def is_datastore_field(value, context):
|
|
|
55
56
|
|
|
56
57
|
:param value: the value to validate
|
|
57
58
|
:param context: the context within which this validation is taking place
|
|
58
|
-
:
|
|
59
|
+
:returns: the value
|
|
59
60
|
"""
|
|
60
61
|
passed_fields = value if isinstance(value, list) else [value]
|
|
61
62
|
fields = get_resource_datastore_fields(toolkit.g.resource['id'])
|
|
@@ -71,7 +72,7 @@ def is_view_id(value, context):
|
|
|
71
72
|
|
|
72
73
|
:param value: the value to validate
|
|
73
74
|
:param context: the context within which this validation is taking place
|
|
74
|
-
:
|
|
75
|
+
:returns: the value
|
|
75
76
|
"""
|
|
76
77
|
if value:
|
|
77
78
|
data = {'id': toolkit.g.resource['id']}
|
{ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/plugin.py
RENAMED
|
@@ -4,15 +4,18 @@
|
|
|
4
4
|
# This file is part of a project
|
|
5
5
|
# Created by the Natural History Museum in London, UK
|
|
6
6
|
|
|
7
|
+
|
|
7
8
|
from ckan.common import json
|
|
8
|
-
from ckan.plugins import
|
|
9
|
+
from ckan.plugins import SingletonPlugin, implements, interfaces, toolkit
|
|
9
10
|
|
|
10
11
|
from ckanext.tiledmap import routes
|
|
11
12
|
from ckanext.tiledmap.config import config as plugin_config
|
|
12
13
|
from ckanext.tiledmap.lib import validators
|
|
13
|
-
from ckanext.tiledmap.lib.helpers import
|
|
14
|
-
from ckanext.tiledmap.lib.utils import
|
|
15
|
-
|
|
14
|
+
from ckanext.tiledmap.lib.helpers import dwc_field_title, mustache_wrapper
|
|
15
|
+
from ckanext.tiledmap.lib.utils import (
|
|
16
|
+
get_resource_datastore_fields,
|
|
17
|
+
get_tileserver_status,
|
|
18
|
+
)
|
|
16
19
|
|
|
17
20
|
try:
|
|
18
21
|
from ckanext.status.interfaces import IStatus
|
|
@@ -12,6 +12,7 @@ from urllib.parse import unquote
|
|
|
12
12
|
|
|
13
13
|
from ckan.common import json
|
|
14
14
|
from ckan.plugins import toolkit
|
|
15
|
+
|
|
15
16
|
from ckanext.tiledmap.config import config
|
|
16
17
|
|
|
17
18
|
|
|
@@ -21,12 +22,12 @@ class MapViewSettings:
|
|
|
21
22
|
"""
|
|
22
23
|
|
|
23
24
|
def __init__(self, fetch_id, view, resource):
|
|
24
|
-
|
|
25
|
+
"""
|
|
25
26
|
:param fetch_id: the id of the request, as provided by the javascript module. This is used
|
|
26
27
|
to keep track on the javascript side of the order map-info requests.
|
|
27
28
|
:param view: the view dict
|
|
28
29
|
:param resource: the resource dict
|
|
29
|
-
|
|
30
|
+
"""
|
|
30
31
|
self.fetch_id = fetch_id
|
|
31
32
|
self.view = view
|
|
32
33
|
self.resource = resource
|
|
@@ -73,7 +74,7 @@ class MapViewSettings:
|
|
|
73
74
|
Returns True if at least one of the map styles (plot, grid, heat) is enabled. If
|
|
74
75
|
none of them are, returns False.
|
|
75
76
|
|
|
76
|
-
:
|
|
77
|
+
:returns: True if one map style is enabled, False if none are
|
|
77
78
|
"""
|
|
78
79
|
return self.plot_map_enabled or self.grid_map_enabled or self.heat_map_enabled
|
|
79
80
|
|
|
@@ -85,7 +86,7 @@ class MapViewSettings:
|
|
|
85
86
|
|
|
86
87
|
:param name: the name of the template
|
|
87
88
|
:param extra_vars: a dict of variables to pass to the template renderer
|
|
88
|
-
:
|
|
89
|
+
:returns: a rendered template
|
|
89
90
|
"""
|
|
90
91
|
# this is the base name of the template, if there's no format version available then we'll
|
|
91
92
|
# just return this
|
|
@@ -105,7 +106,7 @@ class MapViewSettings:
|
|
|
105
106
|
"""
|
|
106
107
|
Renders the point info template and returns the result.
|
|
107
108
|
|
|
108
|
-
:
|
|
109
|
+
:returns: the rendered point info template
|
|
109
110
|
"""
|
|
110
111
|
return self._render_template(
|
|
111
112
|
config['versioned_tilemap.info_template'],
|
|
@@ -120,7 +121,7 @@ class MapViewSettings:
|
|
|
120
121
|
"""
|
|
121
122
|
Renders the point hover info template and returns the result.
|
|
122
123
|
|
|
123
|
-
:
|
|
124
|
+
:returns: the rendered point hover info template
|
|
124
125
|
"""
|
|
125
126
|
return self._render_template(
|
|
126
127
|
config['versioned_tilemap.quick_info_template'],
|
|
@@ -137,9 +138,9 @@ class MapViewSettings:
|
|
|
137
138
|
retrieved from the config object.
|
|
138
139
|
|
|
139
140
|
:param style: the name of the style (plot, gridded or heatmap)
|
|
140
|
-
:param names: the names of the parameters to retrieve, these are also used as
|
|
141
|
-
|
|
142
|
-
:
|
|
141
|
+
:param names: the names of the parameters to retrieve, these are also used as
|
|
142
|
+
the names in the dict that the parameter values are stored under
|
|
143
|
+
:returns: a dict
|
|
143
144
|
"""
|
|
144
145
|
params = {}
|
|
145
146
|
for name in names:
|
|
@@ -161,7 +162,7 @@ class MapViewSettings:
|
|
|
161
162
|
(e.g. [[0, 4], [70, 71]]). This is how it is returned by the datastore_query_extent
|
|
162
163
|
action.
|
|
163
164
|
|
|
164
|
-
:
|
|
165
|
+
:returns: a 3-tuple - (int, int, list)
|
|
165
166
|
"""
|
|
166
167
|
q, filters = extract_q_and_filters()
|
|
167
168
|
# get query extent and counts
|
|
@@ -199,7 +200,7 @@ class MapViewSettings:
|
|
|
199
200
|
- the query body is then sent along with all tile requests to the tile server, which
|
|
200
201
|
decompresses it and uses it to search elasticsearch
|
|
201
202
|
|
|
202
|
-
:
|
|
203
|
+
:returns: a url safe base64 encoded, gzipped, JSON string
|
|
203
204
|
"""
|
|
204
205
|
q, filters = extract_q_and_filters()
|
|
205
206
|
result = toolkit.get_action('datastore_search')(
|
|
@@ -220,7 +221,7 @@ class MapViewSettings:
|
|
|
220
221
|
Using the settings available on this object, create the /map-info response dict
|
|
221
222
|
and return it.
|
|
222
223
|
|
|
223
|
-
:
|
|
224
|
+
:returns: a dict
|
|
224
225
|
"""
|
|
225
226
|
# get the standard map info dict (this provides a fresh one each time it's called)
|
|
226
227
|
map_info = get_base_map_info()
|
|
@@ -324,7 +325,7 @@ def build_url(*parts):
|
|
|
324
325
|
Given a bunch of parts, build a URL by joining them together with a /.
|
|
325
326
|
|
|
326
327
|
:param parts: the URL parts
|
|
327
|
-
:
|
|
328
|
+
:returns: a URL string
|
|
328
329
|
"""
|
|
329
330
|
return '/'.join(part.strip('/') for part in parts)
|
|
330
331
|
|
|
@@ -334,7 +335,8 @@ def extract_q_and_filters():
|
|
|
334
335
|
Extract the q and filters query string parameters from the request. These are
|
|
335
336
|
standard parameters in the resource views and have a standardised format too.
|
|
336
337
|
|
|
337
|
-
:
|
|
338
|
+
:returns: a 2-tuple of the q value (string, or None) and the filters value (dict, or
|
|
339
|
+
None)
|
|
338
340
|
"""
|
|
339
341
|
# get the query if there is one
|
|
340
342
|
q = (
|
|
@@ -364,10 +366,11 @@ def get_base_map_info():
|
|
|
364
366
|
running CKAN instance (they use either always static values or ones that are pulled
|
|
365
367
|
from the config which can are set on boot).
|
|
366
368
|
|
|
367
|
-
A few settings are missing, these are set in MapViewSettings.create_map_info as they
|
|
368
|
-
custom per-map settings that the user has control over or are dependant on
|
|
369
|
+
A few settings are missing, these are set in MapViewSettings.create_map_info as they
|
|
370
|
+
require custom per-map settings that the user has control over or are dependant on
|
|
371
|
+
the target resource.
|
|
369
372
|
|
|
370
|
-
:
|
|
373
|
+
:returns: a dict of settings
|
|
371
374
|
"""
|
|
372
375
|
png_url = build_url(config['versioned_tilemap.tile_server'], '/{z}/{x}/{y}.png')
|
|
373
376
|
utf_grid_url = build_url(
|
{ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/routes/map.py
RENAMED
|
@@ -16,7 +16,7 @@ def info():
|
|
|
16
16
|
"""
|
|
17
17
|
Returns metadata about a given map in JSON form.
|
|
18
18
|
|
|
19
|
-
:
|
|
19
|
+
:returns: A JSON encoded string representing the metadata
|
|
20
20
|
"""
|
|
21
21
|
view_settings = _helpers.MapViewSettings.from_request()
|
|
22
22
|
|
|
@@ -51,7 +51,10 @@ div.tiled-map-info {
|
|
|
51
51
|
.info {
|
|
52
52
|
color: #555;
|
|
53
53
|
padding: 6px 8px;
|
|
54
|
-
font:
|
|
54
|
+
font:
|
|
55
|
+
14px/16px Arial,
|
|
56
|
+
Helvetica,
|
|
57
|
+
sans-serif;
|
|
55
58
|
background: rgba(255, 255, 255, 0.95);
|
|
56
59
|
box-shadow: 0 0 15px rgba(0, 0, 0, 0.7);
|
|
57
60
|
border-radius: 10px;
|
|
@@ -62,7 +65,10 @@ div.tiled-map-info {
|
|
|
62
65
|
.small-info {
|
|
63
66
|
color: #555;
|
|
64
67
|
padding: 6px 8px;
|
|
65
|
-
font:
|
|
68
|
+
font:
|
|
69
|
+
14px/16px Arial,
|
|
70
|
+
Helvetica,
|
|
71
|
+
sans-serif;
|
|
66
72
|
background: rgba(255, 255, 255, 0.95);
|
|
67
73
|
box-shadow: 0 0 15px rgba(0, 0, 0, 0.7);
|
|
68
74
|
border-radius: 10px;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: ckanext-versioned-tiledmap
|
|
3
|
-
Version: 2.3.
|
|
3
|
+
Version: 2.3.4
|
|
4
4
|
Summary: A CKAN extension with a map view for versioned-datastore backed resources.
|
|
5
5
|
Author-email: Natural History Museum <data@nhm.ac.uk>
|
|
6
6
|
License: GPL-3.0-or-later
|
|
@@ -18,20 +18,25 @@ Requires-Python: >=3.6
|
|
|
18
18
|
Description-Content-Type: text/markdown
|
|
19
19
|
License-File: LICENSE
|
|
20
20
|
Requires-Dist: ckanext-versioned-datastore>=3.7.0
|
|
21
|
-
Requires-Dist: ckantools>=0.3.0
|
|
22
21
|
Requires-Dist: cachetools>=4.2.4
|
|
22
|
+
Requires-Dist: ckantools>=0.4.2
|
|
23
23
|
Provides-Extra: test
|
|
24
24
|
Requires-Dist: mock; extra == "test"
|
|
25
25
|
Requires-Dist: pytest>=4.6.5; extra == "test"
|
|
26
26
|
Requires-Dist: pytest-cov>=2.7.1; extra == "test"
|
|
27
27
|
Requires-Dist: coveralls; extra == "test"
|
|
28
|
+
Dynamic: license-file
|
|
28
29
|
|
|
29
30
|
<!--header-start-->
|
|
30
|
-
<
|
|
31
|
+
<picture>
|
|
32
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://data.nhm.ac.uk/images/nhm_logo.svg">
|
|
33
|
+
<source media="(prefers-color-scheme: light)" srcset="https://data.nhm.ac.uk/images/nhm_logo_black.svg">
|
|
34
|
+
<img alt="The Natural History Museum logo." src="https://data.nhm.ac.uk/images/nhm_logo_black.svg" align="left" width="150px" height="100px" hspace="40">
|
|
35
|
+
</picture>
|
|
31
36
|
|
|
32
37
|
# ckanext-versioned-tiledmap
|
|
33
38
|
|
|
34
|
-
[](https://github.com/NaturalHistoryMuseum/ckanext-versioned-tiledmap/actions/workflows/tests.yml)
|
|
35
40
|
[](https://coveralls.io/github/NaturalHistoryMuseum/ckanext-versioned-tiledmap)
|
|
36
41
|
[](https://github.com/ckan/ckan)
|
|
37
42
|
[](https://www.python.org/)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "ckanext-versioned-tiledmap"
|
|
3
|
-
version = "2.3.
|
|
3
|
+
version = "2.3.4"
|
|
4
4
|
description = "A CKAN extension with a map view for versioned-datastore backed resources."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.6"
|
|
@@ -20,8 +20,8 @@ classifiers = [
|
|
|
20
20
|
]
|
|
21
21
|
dependencies = [
|
|
22
22
|
"ckanext-versioned-datastore>=3.7.0",
|
|
23
|
-
"
|
|
24
|
-
"
|
|
23
|
+
"cachetools>=4.2.4",
|
|
24
|
+
"ckantools>=0.4.2"
|
|
25
25
|
]
|
|
26
26
|
|
|
27
27
|
[project.optional-dependencies]
|
|
@@ -57,7 +57,7 @@ exclude = ["tests", "docs"]
|
|
|
57
57
|
|
|
58
58
|
[tool.commitizen]
|
|
59
59
|
name = "cz_nhm"
|
|
60
|
-
version = "2.3.
|
|
60
|
+
version = "2.3.4"
|
|
61
61
|
tag_format = "v$version"
|
|
62
62
|
update_changelog_on_bump = true
|
|
63
63
|
changelog_incremental = true
|
|
@@ -66,13 +66,34 @@ version_files = [
|
|
|
66
66
|
"CITATION.cff:^version"
|
|
67
67
|
]
|
|
68
68
|
|
|
69
|
-
[tool.
|
|
70
|
-
|
|
71
|
-
skip_string_normalization = true
|
|
69
|
+
[tool.ruff]
|
|
70
|
+
target-version = "py38"
|
|
72
71
|
|
|
73
|
-
[tool.
|
|
74
|
-
|
|
75
|
-
|
|
72
|
+
[tool.ruff.format]
|
|
73
|
+
quote-style = "single"
|
|
74
|
+
|
|
75
|
+
[tool.ruff.lint]
|
|
76
|
+
select = [
|
|
77
|
+
"E",
|
|
78
|
+
"F",
|
|
79
|
+
"I",
|
|
80
|
+
"D"
|
|
81
|
+
]
|
|
82
|
+
ignore = [
|
|
83
|
+
"D100",
|
|
84
|
+
"D104",
|
|
85
|
+
"D200",
|
|
86
|
+
"D202",
|
|
87
|
+
"D203",
|
|
88
|
+
"D205",
|
|
89
|
+
"D206",
|
|
90
|
+
"D212",
|
|
91
|
+
"D300",
|
|
92
|
+
"D401",
|
|
93
|
+
"E111",
|
|
94
|
+
"E114",
|
|
95
|
+
"E117"
|
|
96
|
+
]
|
|
76
97
|
|
|
77
98
|
[tool.docformatter]
|
|
78
99
|
wrap-summaries = 88
|
{ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/tests/test_validators.py
RENAMED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
+
from unittest.mock import MagicMock, patch
|
|
2
|
+
|
|
1
3
|
import pytest
|
|
2
4
|
from ckan.plugins import toolkit
|
|
5
|
+
|
|
3
6
|
from ckanext.tiledmap.lib.validators import (
|
|
4
7
|
colour_validator,
|
|
5
8
|
float_01_validator,
|
|
6
9
|
is_datastore_field,
|
|
7
10
|
is_view_id,
|
|
8
11
|
)
|
|
9
|
-
from unittest.mock import MagicMock, patch
|
|
10
12
|
|
|
11
13
|
|
|
12
14
|
def test_colour_validator():
|
|
File without changes
|
|
File without changes
|
{ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/__init__.py
RENAMED
|
File without changes
|
{ckanext_versioned_tiledmap-2.3.2 → ckanext_versioned_tiledmap-2.3.4}/ckanext/tiledmap/config.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|