Skip to content

Protomap basemap for apps#280

Open
drewda wants to merge 8 commits intomainfrom
replace-carto-basemaps
Open

Protomap basemap for apps#280
drewda wants to merge 8 commits intomainfrom
replace-carto-basemaps

Conversation

@drewda
Copy link
Member

@drewda drewda commented Jan 7, 2026

No description provided.

@drewda drewda marked this pull request as ready for review January 8, 2026 06:39
Copilot AI review requested due to automatic review settings January 8, 2026 06:39
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request replaces the old protomaps-themes-base package (v1.3.1) with the newer @protomaps/basemaps package (v5.7.0), introducing support for vector-based Protomaps basemaps with multiple theme variants (light, dark, white, grayscale, black) across the application. The default basemap is changed from Carto to Protomaps grayscale throughout the codebase.

Key changes:

  • Replaces protomaps-themes-base dependency with @protomaps/basemaps v5.7.0
  • Adds five new Protomaps basemap variants with vector tile support
  • Updates all map components to default to protomaps-grayscale instead of carto
  • Implements special handling for vector basemaps (Protomaps) vs raster basemaps (Carto, Nearmap)

Reviewed changes

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

Show a summary per file
File Description
yarn.lock Removes old protomaps-themes-base@1.3.1 and adds @protomaps/basemaps@5.7.0
package.json Updates dependencies and exports new basemap utilities via "./lib/basemaps"
src/runtime/composables/useBasemapLayers.ts Adds five Protomaps basemap configurations, exports Protomaps utilities, and defines constants for glyphs/sprite URLs
src/runtime/components/pathway-map.vue Changes default basemap from 'carto' to 'protomaps-grayscale'
src/runtime/apps/transfers/station-select-map.vue Switches to Protomaps grayscale basemap with proper vector layer initialization
src/runtime/apps/transfers/station-bbox-select-map.vue Switches to Protomaps grayscale basemap with proper vector layer initialization
src/runtime/apps/transfers/platform-pathway-map.vue Changes default basemap to 'protomaps-grayscale'
src/runtime/apps/stations/station-editor.vue Changes default basemap to 'protomaps-grayscale'
src/runtime/apps/stations/pathway-map.vue Changes default basemap to 'protomaps-grayscale'
src/runtime/apps/stations/pages/station-stops.vue Changes default basemap to 'protomaps-grayscale'
src/runtime/apps/stations/pages/station-pathways.vue Changes default basemap to 'protomaps-grayscale'
src/runtime/apps/stations/level-map.vue Adds comprehensive vector basemap support with visibility toggling and switches default to Protomaps
src/runtime/apps/stations/level-editor.vue Changes default basemap to 'protomaps-grayscale'
src/runtime/apps/stations/basemap-control.vue Changes default basemap prop to 'protomaps-grayscale'

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

*/
export function useBasemapLayers () {
const config = useRuntimeConfig()
const protomapsApikey = config.public.tlv2?.protomapsApikey
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

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

The protomapsApikey is being interpolated directly into tile URLs without validation. If the API key is undefined or null, this will result in malformed URLs like "...?key=undefined" for all Protomaps basemap variants. Consider adding validation or a fallback to handle missing API key configuration gracefully, or at minimum document that the API key is required.

Copilot uses AI. Check for mistakes.
export const PROTOMAPS_GLYPHS_URL = 'https://protomaps.github.io/basemaps-assets/fonts/{fontstack}/{range}.pbf'

/**
* Protomaps sprite URL base for MapLibre styles (append flavor name, e.g. /light)
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

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

The documentation comment states to "append flavor name, e.g. /light" but this is misleading. The actual URL should append the specific theme identifier (e.g., "/light" or "/dark"). Consider clarifying the comment to specify the exact format expected, such as "append theme identifier (e.g., '/light', '/dark')" to be more precise.

Suggested change
* Protomaps sprite URL base for MapLibre styles (append flavor name, e.g. /light)
* Protomaps sprite URL base for MapLibre styles (append theme identifier, e.g. '/light', '/dark')

Copilot uses AI. Check for mistakes.
type: 'raster',
tiles: basemaps.carto.source.tiles,
},
'protomaps-base': grayscaleBasemap.source as any,
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

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

Using 'as any' type assertion bypasses TypeScript's type safety. The source configuration should match MapLibre's expected source type. Consider properly typing the grayscaleBasemap.source or using a more specific type assertion to maintain type safety.

Copilot uses AI. Check for mistakes.
version: 8,
sources: {
carto: basemaps.carto.source
'protomaps-base': grayscaleBasemap.source as any
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

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

Using 'as any' type assertion bypasses TypeScript's type safety. The source configuration should match MapLibre's expected source type. Consider properly typing the grayscaleBasemap.source or using a more specific type assertion to maintain type safety.

Copilot uses AI. Check for mistakes.
Comment on lines +75 to +141
'protomaps-light': {
label: 'Protomaps (light)',
source: {
type: 'vector',
tiles: [`https://api.protomaps.com/tiles/v4/{z}/{x}/{y}.pbf?key=${protomapsApikey}`],
maxzoom: 14,
attribution: '<a href="https://www.transit.land/terms">Transitland</a> | <a href="https://protomaps.com">Protomaps</a> | &copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
},
layer: {
// For vector sources, we need to add multiple layers, not just one
// This will be handled specially in the map initialization
isVector: true,
flavor: LIGHT
}
},
'protomaps-dark': {
label: 'Protomaps (dark)',
source: {
type: 'vector',
tiles: [`https://api.protomaps.com/tiles/v4/{z}/{x}/{y}.pbf?key=${protomapsApikey}`],
maxzoom: 14,
attribution: '<a href="https://www.transit.land/terms">Transitland</a> | <a href="https://protomaps.com">Protomaps</a> | &copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
},
layer: {
isVector: true,
flavor: DARK
}
},
'protomaps-white': {
label: 'Protomaps (white)',
source: {
type: 'vector',
tiles: [`https://api.protomaps.com/tiles/v4/{z}/{x}/{y}.pbf?key=${protomapsApikey}`],
maxzoom: 14,
attribution: '<a href="https://www.transit.land/terms">Transitland</a> | <a href="https://protomaps.com">Protomaps</a> | &copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
},
layer: {
isVector: true,
flavor: WHITE
}
},
'protomaps-grayscale': {
label: 'Protomaps (grayscale)',
source: {
type: 'vector',
tiles: [`https://api.protomaps.com/tiles/v4/{z}/{x}/{y}.pbf?key=${protomapsApikey}`],
maxzoom: 14,
attribution: '<a href="https://www.transit.land/terms">Transitland</a> | <a href="https://protomaps.com">Protomaps</a> | &copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
},
layer: {
isVector: true,
flavor: GRAYSCALE
}
},
'protomaps-black': {
label: 'Protomaps (black)',
source: {
type: 'vector',
tiles: [`https://api.protomaps.com/tiles/v4/{z}/{x}/{y}.pbf?key=${protomapsApikey}`],
maxzoom: 14,
attribution: '<a href="https://www.transit.land/terms">Transitland</a> | <a href="https://protomaps.com">Protomaps</a> | &copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
},
layer: {
isVector: true,
flavor: BLACK
}
},
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

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

The source configuration for all five Protomaps basemap variants contains identical code with the same tiles URL, maxzoom, and attribution. This repetition violates DRY principles and makes maintenance harder. Consider extracting the common configuration into a shared constant or helper function to reduce duplication.

Copilot uses AI. Check for mistakes.
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