Skip to content

Commit 31c2d8d

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents 5456b59 + eeb924e commit 31c2d8d

207 files changed

Lines changed: 5688 additions & 129507 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.bowerrc

Lines changed: 0 additions & 3 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Tests
2+
on: [push, pull_request]
3+
jobs:
4+
lint:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- uses: actions/checkout@v4
8+
- uses: actions/setup-python@v5
9+
with:
10+
python-version: '3.10'
11+
- name: Install requirements
12+
run: pip install flake8 pycodestyle
13+
- name: Check syntax
14+
run: flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics --exclude ckan
15+
16+
test:
17+
needs: lint
18+
strategy:
19+
matrix:
20+
include:
21+
- ckan-version: "2.11"
22+
ckan-image: "ckan/ckan-dev:2.11-py3.10"
23+
- ckan-version: "2.10"
24+
ckan-image: "ckan/ckan-dev:2.10-py3.10"
25+
- ckan-version: "2.9"
26+
ckan-image: "ckan/ckan-dev:2.9-py3.9"
27+
fail-fast: false
28+
29+
name: CKAN ${{ matrix.ckan-version }}
30+
runs-on: ubuntu-latest
31+
container:
32+
image: ${{ matrix.ckan-image }}
33+
options: --user root
34+
services:
35+
solr:
36+
image: ckan/ckan-solr:${{ matrix.ckan-version }}-solr9
37+
postgres:
38+
image: ckan/ckan-postgres-dev:${{ matrix.ckan-version }}
39+
env:
40+
POSTGRES_USER: postgres
41+
POSTGRES_PASSWORD: postgres
42+
POSTGRES_DB: postgres
43+
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
44+
redis:
45+
image: redis:3
46+
env:
47+
CKAN_SQLALCHEMY_URL: postgresql://ckan_default:pass@postgres/ckan_test
48+
CKAN_DATASTORE_WRITE_URL: postgresql://datastore_write:pass@postgres/datastore_test
49+
CKAN_DATASTORE_READ_URL: postgresql://datastore_read:pass@postgres/datastore_test
50+
CKAN_SOLR_URL: http://solr:8983/solr/ckan
51+
CKAN_REDIS_URL: redis://redis:6379/1
52+
53+
steps:
54+
- uses: actions/checkout@v4
55+
- name: Install requirements
56+
run: |
57+
pip install -r dev-requirements.txt
58+
pip install -e .
59+
# Replace default path to CKAN core config file with the one on the container
60+
sed -i -e 's/use = config:.*/use = config:\/srv\/app\/src\/ckan\/test-core.ini/' test.ini
61+
- name: Setup extension
62+
run: |
63+
ckan -c test.ini db init
64+
- name: Run tests
65+
run: pytest --ckan-ini=test.ini --disable-warnings ckanext/geoview/tests

README.rst

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ used to be part of ckanext-spatial_.
1010
**Note:** This is a work in progress, if you can help with `OpenLayers`_ or `Leaflet`_ development,
1111
check the `Issues` section for what needs to be done or add a new issue.
1212

13-
This extensions supports CKAN 2.6 onwards, including Python 3 support on CKAN 2.9 or higher.
13+
This extensions supports CKAN 2.7 onwards, including Python 3 support on CKAN 2.9 or higher.
1414

1515
------------
1616
Installation
@@ -76,11 +76,11 @@ OpenLayers Viewer
7676

7777
The OpenLayers_ viewer provides access to different geospatial formats and services:
7878

79-
To enable it, add ``geo_view`` to your ``ckan.plugins`` setting. (use ``geo_preview`` if you are using CKAN < 2.3)::
79+
To enable it, add ``geo_view`` to your ``ckan.plugins`` setting.::
8080

8181
ckan.plugins = ... resource_proxy geo_view
8282

83-
On CKAN >= 2.3, if you want the geospatial views to be created by default, add the plugin to the following setting::
83+
If you want the geospatial views to be created by default, add the plugin to the following setting::
8484

8585

8686
ckan.views.default_views = ... geo_view
@@ -247,11 +247,11 @@ Leaflet GeoJSON Viewer
247247

248248
The Leaflet_ GeoJSON_ viewer will render GeoJSON files on a map and add a popup showing the features properties, for those resources that have a ``geojson`` format.
249249

250-
To enable it, add ``geojson_view`` to your ``ckan.plugins`` setting. (use ``geojson_preview`` if you are using CKAN < 2.3)::
250+
To enable it, add ``geojson_view`` to your ``ckan.plugins`` setting.::
251251

252252
ckan.plugins = ... resource_proxy geojson_view
253253

254-
On CKAN >= 2.3, if you want the views to be created by default on all GeoJSON files, add the plugin to the following setting::
254+
If you want the views to be created by default on all GeoJSON files, add the plugin to the following setting::
255255

256256

257257
ckan.views.default_views = ... geojson_view
@@ -269,11 +269,11 @@ Leaflet WMTS Viewer
269269

270270
The Leaflet_ WMTS viewer will render WMTS (Web Map Tile Service) layers on a map for those resources that have a ``wmts`` format.
271271

272-
To enable it, add ``wmts_view`` to your ``ckan.plugins`` setting. (use ``wmts_preview`` if you are using CKAN < 2.3)::
272+
To enable it, add ``wmts_view`` to your ``ckan.plugins`` setting.::
273273

274274
ckan.plugins = ... resource_proxy wmts_view
275275

276-
On CKAN >= 2.3, if you want the views to be created by default on all WMTS resources, add the plugin to the following setting::
276+
If you want the views to be created by default on all WMTS resources, add the plugin to the following setting::
277277

278278

279279
ckan.views.default_views = ... wmts_view
@@ -286,11 +286,11 @@ Leaflet ESRI Shapefile Viewer
286286

287287
The Leaflet_ Shapefile_ viewer will render ESRI Shapfiles (A ZIP archive contains the .shp, .shx, .dbf, and .prj files) on a map and add a popup showing the features properties, for those resources that have a ``shp`` format.
288288

289-
To enable it, add ``shp_view`` to your ``ckan.plugins`` setting. (use ``shp_preview`` if you are using CKAN < 2.3)::
289+
To enable it, add ``shp_view`` to your ``ckan.plugins`` setting.::
290290

291291
ckan.plugins = ... resource_proxy shp_view
292292

293-
On CKAN >= 2.3, if you want the views to be created by default on all Shapefiles, add the plugin to the following setting::
293+
If you want the views to be created by default on all Shapefiles, add the plugin to the following setting::
294294

295295

296296
ckan.views.default_views = ... shp_view
@@ -310,7 +310,7 @@ Common base layers for Map Widgets
310310

311311
The geospatial view plugins support the same base map configurations than the ckanext-spatial `widgets`_.
312312

313-
Check the following page to learn how to choose a different base map layer (Stamen, MapBox or custom):
313+
Check the following page to learn how to choose a different base map layer:
314314

315315
http://docs.ckan.org/projects/ckanext-spatial/en/latest/map-widgets.html
316316

@@ -319,9 +319,27 @@ http://docs.ckan.org/projects/ckanext-spatial/en/latest/map-widgets.html
319319

320320
.. _widgets: http://docs.ckan.org/projects/ckanext-spatial/en/latest/spatial-search.html#spatial-search-widget
321321

322+
> [!WARNING]
323+
> As of July 2024 the common map configuration is not working with the OpenLayers viewer. Pull requests are welcome to address the issue
324+
325+
-------------------------
326+
Updating the JS libraries
327+
-------------------------
328+
329+
To update a JS library to a new version:
330+
331+
1. Update the version number in ``package.json``
332+
2. Run ``npm install``
333+
3. Run ``npm run update-libs``
334+
335+
The following libraries are managed manually as they don't have npm packages:
336+
337+
* ol-helpers
338+
* shp2geojson
339+
322340

323341
-----------------------------------
324-
Registering ckanext-geoview on PyPI
342+
Registering ckanext-geoview on pypi
325343
-----------------------------------
326344

327345
ckanext-geoview should be availabe on PyPI as

bower.json

Lines changed: 0 additions & 14 deletions
This file was deleted.

ckanext/geoview/assets/css/geo-resource-styles.css

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.label[data-format=wfs] {
1+
.badge[data-format=wfs] {
22
background-color: #7aae3d;
33
}
44
.format-label[data-format=wfs],
@@ -11,7 +11,7 @@
1111
height: 35px;
1212
}
1313

14-
.label[data-format=wms] {
14+
.badge[data-format=wms] {
1515
background-color: #adc717;
1616
}
1717
.format-label[data-format=wms],
@@ -24,7 +24,7 @@
2424
height: 35px;
2525
}
2626

27-
.label[data-format=gml] {
27+
.badge[data-format=gml] {
2828
background-color: #7aae3d;
2929
}
3030
.format-label[data-format=gml],
@@ -37,7 +37,7 @@
3737
height: 35px;
3838
}
3939

40-
.label[data-format=kml] {
40+
.badge[data-format=kml] {
4141
background-color: #7aae3d;
4242
}
4343
.format-label[data-format=kml],
@@ -50,7 +50,7 @@
5050
height: 35px;
5151
}
5252

53-
.label[data-format=geojson] {
53+
.badge[data-format=geojson] {
5454
background-color: #9855e0;
5555
}
5656
.format-label[data-format=geojson],
@@ -63,7 +63,7 @@
6363
height: 35px;
6464
}
6565

66-
.label[data-format=wmts] {
66+
.badge[data-format=wmts] {
6767
background-color: #3333ff;
6868
}
6969
.format-label[data-format=wmts],
@@ -76,7 +76,7 @@
7676
height: 35px;
7777
}
7878

79-
.label[data-format=shp] {
79+
.badge[data-format=shp] {
8080
background-color: #0080ff;
8181
}
8282
.format-label[data-format=shp],
@@ -89,6 +89,6 @@
8989
height: 35px;
9090
}
9191

92-
.label[data-format=arcgis_rest] {
92+
.badge[data-format=arcgis_rest] {
9393
background-color: #5c3ee0;
9494
}

ckanext/geoview/assets/css/geojson_preview.css

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,13 @@ html, body {
1919
height: 300px;
2020
overflow: auto;
2121
}
22+
23+
.leaflet-control-no-provider {
24+
background-color: white;
25+
margin-right: 10px;
26+
padding: 10px;
27+
border: 1px solid #b1b1b1;
28+
}
29+
.leaflet-control-attribution {
30+
font-size: 11px;
31+
}

ckanext/geoview/assets/css/shp_preview.css

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,13 @@ html, body {
3636
overflow: auto;
3737
max-height: 200px;
3838
}
39+
40+
.leaflet-control-no-provider {
41+
background-color: white;
42+
margin-right: 10px;
43+
padding: 10px;
44+
border: 1px solid #b1b1b1;
45+
}
46+
.leaflet-control-attribution {
47+
font-size: 11px;
48+
}

ckanext/geoview/assets/css/wmts_preview.css

Lines changed: 15 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -11,42 +11,20 @@ html, body {
1111
height: 100%;
1212
}
1313

14-
#map .table{
15-
width: 300px;
16-
}
17-
18-
#map label {
19-
font-weight: normal;
20-
}
21-
22-
#map label:after {
23-
content: none;
24-
}
25-
26-
#map input {
27-
width: auto;
28-
top: auto;
29-
}
30-
3114
.leaflet-control-layers {
32-
box-shadow: 0 1px 7px rgba(0,0,0,0.4);
33-
background: #f8f8f9;
34-
-webkit-border-radius: 5px;
35-
border-radius: 5px;
36-
overflow: auto;
3715
max-height: 200px;
16+
overflow-y: hidden;
3817
}
3918

4019
.ui-opacity {
41-
box-shadow: 0 0 8px rgba(0,0,0,0.4);
4220
background: rgba(255, 255, 255, 0.8);
4321
position: absolute;
44-
left: 13px;
45-
top: 70px;
22+
left: 14px;
23+
top: 80px;
4624
height: 200px;
4725
width: 22px;
48-
border: 1px solid #888;
49-
border-radius: 5px;
26+
border: 2px solid rgba(0, 0, 0, 0.2);
27+
border-radius: 4px;
5028
z-index: 1000;
5129
}
5230

@@ -65,3 +43,13 @@ html, body {
6543
.ui-opacity .handle:hover {
6644
background: #303030;
6745
}
46+
47+
.leaflet-control-no-provider {
48+
background-color: white;
49+
margin-right: 10px;
50+
padding: 10px;
51+
border: 1px solid #b1b1b1;
52+
}
53+
.leaflet-control-attribution {
54+
font-size: 11px;
55+
}

0 commit comments

Comments
 (0)