Skip to content

Commit

Permalink
feat: add ability to add GeoJSON URL external layers (#3127)
Browse files Browse the repository at this point in the history
Implements: https://dhis2.atlassian.net/browse/DHIS2-15981

If geojson external overlay layers are configured for instance, they can now be added to a map.
The data table will display the layer data as long as the collection is of homogenous geo types.
User can also click on a feature and the right panel will open, showing the feature data.

fix: check full instanceUrl and handle not response.ok in geojson loader (#3142)

In production, the baseUrl is ".." and therefore the comparison will always be false.
So check the instanceBaseUrl instead

Also, a failed response from fetch, like 400, will return !response.ok,
so that situation needed to be handled as well.

fix: rename error to loadError to avoid name clash with building footprint ee layer (#3144)

The building footprints earth engine layer has a property named error.
That was getting picked up by the new notice box in the Card that was added to
report geojson loading errors. Solution was to rename the error property in geojsonloader to loadError.

fix: show no data message when geojson feature has no data (#3145)

Geojson layers may or may not have data associated with them.
Show an appropriate message if there is no data.

fix: improve geojson layer error responses and cypress tests (#3149)

fix: reduce the padding to make room for the scrollbar (#3148)

fix: prevent data table effects from running code when no table (#3147)

fix: map plugin - do not load async layers multiple times (#3143)

fix: various fixes after release testing (#3151)

* fix: limit stroke width to 0-10

* fix: tab length should only take the space of the title

* fix: reset error when switching which layer shows data table

* fix: highlight features when data table has filter

* chore: improve legend for geojson layers

* fix: set point radius  to size that was set in the style settings

* fix: the feature.id is set in maps-gl so use the properties.id instead find correct data

* chore: legend item styling - set max line weight and rename to Point radius

* fix: use more understandable error messages

* fix: set minimum point size of 1

fix: final fixes for geojson (#3154)

* fix: upgrade maps-gl for the rounded line join and caps

* fix: add tooltip on layer thumbnails

* chore: update i18n

* fix: set map bounds after all layers are added to the map

* fix: values that are strings but numeric in quality were not filtering

* fix: onLayerAdded wasnt defined for SplitViews

* Revert "fix: onLayerAdded wasnt defined for SplitViews"

This reverts commit deeb327.

* Revert "fix: set map bounds after all layers are added to the map"

This reverts commit e1c0a58.

* fix: make logic match prev code

* fix: position tooltip right over the thumbnail title
  • Loading branch information
jenniferarnesen committed Mar 18, 2024
1 parent 4b1076c commit fbdf0b0
Show file tree
Hide file tree
Showing 80 changed files with 3,408 additions and 476 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ node_modules/
build/
webpack.config.js
src/locales
cypress/fixtures/*


# ide
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/dhis2-verify-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on:
branches:
- 'master'
- 'dev'
tags:
- '*'

env:
GIT_AUTHOR_NAME: '@dhis2-bot'
Expand Down Expand Up @@ -98,7 +100,7 @@ jobs:
if: |
!github.event.push.repository.fork &&
github.actor != 'dependabot[bot]' &&
github.ref == 'refs/heads/master'
(github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev')
steps:
- uses: actions/checkout@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ node_modules
.d2
src/locales
build
cypress/fixtures/network
cypress/fixtures/*
cypress.env.json
docs
colorbrewer.js
Expand Down
2 changes: 1 addition & 1 deletion cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ module.exports = defineConfig({
// Enabled to reduce the risk of out-of-memory issues
experimentalMemoryManagement: true,
// Set to a low number to reduce the risk of out-of-memory issues
numTestsKeptInMemory: 4,
numTestsKeptInMemory: 3,
/* When allowing 1 retry on CI, the test suite will pass if
* it's flaky. And/but we also get to identify flaky tests on the
* Cypress Dashboard. */
Expand Down
70 changes: 70 additions & 0 deletions cypress/fixtures/externalMapLayersWithGeojson.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"externalMapLayers": [
{
"mapService": "XYZ",
"url": "https://cartodb-basemaps-{s}.global.ssl.fastly.net/dark_all/{z}/{x}/{y}.png",
"attribution": "&copy; <a href=\\\"http://www.openstreetmap.org/copyright\\\">OpenStreetMap</a>, <a href=\\\"https://carto.com/attributions\\\">CARTO</a>",
"imageFormat": "PNG",
"mapLayerPosition": "BASEMAP",
"id": "LOw2p0kPwua",
"name": " Dark basemap"
},
{
"mapService": "GEOJSON_URL",
"url": "https://test.e2e.dhis2.org/dev-kfmt/api/routes/aa42a120003/run",
"imageFormat": "PNG",
"mapLayerPosition": "OVERLAY",
"id": "JYJjKIa0NsI",
"name": "Bo Catchment geojson"
},
{
"mapService": "GEOJSON_URL",
"url": "https://test.e2e.dhis2.org/dev-kfmt/api/routes/xyz99910rst/run",
"imageFormat": "PNG",
"mapLayerPosition": "OVERLAY",
"id": "ZAxxTmtINN8",
"name": "CC Bo expired"
},
{
"mapService": "GEOJSON_URL",
"url": "https://dhis2.github.io/maps-app/public/temp/BandajumaClinic.geojson",
"imageFormat": "PNG",
"mapLayerPosition": "OVERLAY",
"id": "ICSoBynB7s0",
"name": "Feature geojson"
},
{
"mapService": "XYZ",
"url": "https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_only_labels/{z}/{x}/{y}.png",
"attribution": "&copy; <a href=\\\"http://www.openstreetmap.org/copyright\\\">OpenStreetMap</a>, <a href=\\\"https://carto.com/attributions\\\">CARTO</a>",
"imageFormat": "PNG",
"mapLayerPosition": "OVERLAY",
"id": "suB1SFdc6RD",
"name": "Labels overlay"
},
{
"mapService": "GEOJSON_URL",
"url": "https://dhis2.github.io/maps-app/public/temp/point-linestring-polygon.geojson",
"imageFormat": "PNG",
"mapLayerPosition": "OVERLAY",
"id": "dpV5peTqmNT",
"name": "Mixed geojson"
},
{
"mapService": "GEOJSON_URL",
"url": "https://test.e2e.dhis2.org/dev-kfmt/api/routes/abc456789rt/run",
"imageFormat": "PNG",
"mapLayerPosition": "OVERLAY",
"id": "Z58y0pce12o",
"name": "Non-existing geojson"
},
{
"mapService": "GEOJSON_URL",
"url": "https://dhis2.github.io/maps-app/public/temp/GbongbomaMCHP.geojson",
"imageFormat": "PNG",
"mapLayerPosition": "OVERLAY",
"id": "LYmVmzRxVAU",
"name": "Polygon only geojson"
}
]
}
Loading

0 comments on commit fbdf0b0

Please sign in to comment.