Skip to content

Use raster tiles for map overlays#1239

Merged
DavidMStraub merged 10 commits into
gramps-project:mainfrom
DavidMStraub:overlay_map_tiles
Jun 12, 2026
Merged

Use raster tiles for map overlays#1239
DavidMStraub merged 10 commits into
gramps-project:mainfrom
DavidMStraub:overlay_map_tiles

Conversation

@DavidMStraub

Copy link
Copy Markdown
Member

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR switches the map view’s media overlays from single-image MapLibre “image” sources to raster tile overlays, adding a dedicated tile-layer web component and a new API URL helper to generate authenticated tile URLs.

Changes:

  • Replace <grampsjs-map-overlay> usage in the map view with a new <grampsjs-map-tile-layer> raster tile overlay component.
  • Add getTileUrl(handle) to generate {z}/{x}/{y} raster tile URLs (optionally including jwt).
  • Update GrampsjsMap style-change handling to rely on transformStyle contributions (and remove the previous overlay re-add flow).

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
src/views/GrampsjsViewMap.js Switches map overlays in the main map view to the new raster tile layer component.
src/components/GrampsjsMapTileLayer.js Introduces a raster tile overlay component that contributes layers via transformStyle and can be toggled hidden/visible.
src/components/GrampsjsMap.js Refactors style-change overlay handling to depend on transformStyle contributors.
src/api.js Adds getTileUrl() helper for authenticated raster tile requests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/components/GrampsjsMapTileLayer.js
Comment thread src/components/GrampsjsMapTileLayer.js
Comment thread src/api.js
Comment thread src/components/GrampsjsMap.js
Comment thread src/views/GrampsjsViewMap.js Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Comment thread src/components/GrampsjsMapOverlay.js
Comment thread src/components/GrampsjsMapTileLayer.js

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Comment thread src/components/GrampsjsMapOverlay.js
Comment thread src/api.js

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Comment thread src/views/GrampsjsViewMap.js
Comment thread src/components/GrampsjsMapTileLayer.js

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Comment thread src/components/GrampsjsMap.js
Comment thread src/components/GrampsjsMapTileLayer.js
Comment thread src/components/GrampsjsMapTileLayer.js Outdated
Comment thread src/components/GrampsjsMapOverlay.js

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Comment thread src/components/GrampsjsMapTileLayer.js

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Comment on lines +200 to +206
// Handles children added after the map's load event (e.g. async data layers).
_onSlotChange() {
if (!this._map?.isStyleLoaded()) return
this._slottedChildren
.filter(el => typeof el.addToMap === 'function')
.forEach(el => el.addToMap(this._map))
}
Comment on lines +44 to +48
addToMap(map) {
this._map = map
map.on('style.load', this._onStyleLoad)
if (!this.handle) return
const layerId = this._layerId
Comment on lines +105 to +108
getTransformStyleContribution(_prev, next) {
if (!this.url || !this._layerId) return next
const coordinates = this._getCoordinates()
if (!coordinates) return next
Comment thread src/api.js
Comment on lines +621 to +625
export function getTileUrl(handle) {
const jwt = localStorage.getItem('access_token')
const base = `${__APIHOST__}/api/media/${handle}/tile/{z}/{x}/{y}`
return jwt ? `${base}?jwt=${jwt}` : base
}
@DavidMStraub DavidMStraub merged commit 31d870d into gramps-project:main Jun 12, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants