Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Replace custom date filtering with maplibre-gl-dates #479

Merged
merged 4 commits into from
Aug 24, 2024

Conversation

1ec5
Copy link
Contributor

@1ec5 1ec5 commented Aug 7, 2024

This replaces the custom date filtering code for the OpenHistoricalMap basemap with maplibre-gl-dates, which is forward-compatible with expression-based filters.

@1ec5
Copy link
Contributor Author

1ec5 commented Aug 7, 2024

I’m unable to test this change locally because of the following error:

gramps-frontend-dev  | Error while transforming src/components/GrampsjsMap.js: Could not resolve import "@openhistoricalmap/maplibre-gl-dates".
gramps-frontend-dev  | 
gramps-frontend-dev  |   3 | import 'maplibre-gl'
gramps-frontend-dev  |   4 | import '@maplibre/maplibre-gl-leaflet'
gramps-frontend-dev  | > 5 | import '@openhistoricalmap/maplibre-gl-dates'
gramps-frontend-dev  |     |        ^
gramps-frontend-dev  |   6 | import './GrampsjsMapOverlay.js'
gramps-frontend-dev  |   7 | import './GrampsjsMapMarker.js'
gramps-frontend-dev  |   8 | import {fireEvent} from '../util.js'
gramps-frontend-dev  | 

I’m not sure why this error occurs, since the @openhistoricalmap/maplibre-gl-dates package has been installed. One unusual aspect is that, as long as this comes after the maplibre-gl import, the module doesn’t export anything; it only adds a method to an existing global maplibregl object.

@DavidMStraub
Copy link
Member

Thanks, big simplification!

I got the import error at first as well, but it worked after restarting the web dev server (npm run start).

It works as expected in the browser, but I see a lot of errors in the console, they are all of the type

layers.land.filter[3][0]: expected one of [==, !=, >, >=, <, <=, in, !in, all, any, none, has, !has], "let" found

It looks like this error occurs for all layers.

@1ec5
Copy link
Contributor Author

1ec5 commented Aug 10, 2024

Thanks, I fixed the error in OpenHistoricalMap/maplibre-gl-dates@d6b6da1 and upgraded the library.

@DavidMStraub DavidMStraub merged commit 802ccc3 into gramps-project:main Aug 24, 2024
1 check passed
@1ec5 1ec5 deleted the maplibre-gl-dates branch September 24, 2024 03:07
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants