-
Notifications
You must be signed in to change notification settings - Fork 2
Protomap basemap for apps #280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
drewda
wants to merge
8
commits into
main
Choose a base branch
from
replace-carto-basemaps
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
9e9275a
Protomap basemap for apps
drewda 1d27457
update to latest @protomaps/basemaps
drewda ebd4882
export
drewda 8106b2d
use protomaps v4 tiles
drewda 551d36e
more in composable
drewda 572a755
sprite url
drewda 8fa3b50
urls from https://docs.protomaps.com/basemaps/maplibre#assets
drewda 23bc198
cheap fix for type warning
drewda File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,7 +8,7 @@ | |
| import { ref, onMounted, onBeforeUnmount, watch, nextTick } from 'vue' | ||
| import { Map as MapLibreMap, NavigationControl, Popup, LngLatBounds } from 'maplibre-gl' | ||
| import type { LngLatLike, MapMouseEvent, GeoJSONSource } from 'maplibre-gl' | ||
| import { useBasemapLayers } from '../../composables/useBasemapLayers' | ||
| import { useBasemapLayers, layers, GRAYSCALE, PROTOMAPS_GLYPHS_URL } from '../../composables/useBasemapLayers' | ||
| import type { StationHub } from './types' | ||
| import { haversinePosition } from '../../lib/geom' | ||
|
|
||
|
|
@@ -66,23 +66,23 @@ const emit = defineEmits<{ | |
| const mapContainer = ref<HTMLElement>() | ||
| const map = ref<MapLibreMap | null>(null) | ||
|
|
||
| // Get basemap configuration from composable | ||
| const { basemapLayers } = useBasemapLayers() | ||
|
|
||
| function initMap (): void { | ||
| if (!mapContainer.value) return | ||
|
|
||
| const { basemapLayers } = useBasemapLayers() | ||
| const basemaps = basemapLayers.value | ||
| const grayscaleBasemap = basemapLayers.value['protomaps-grayscale'] | ||
|
|
||
| const mapValue = new MapLibreMap({ | ||
| container: mapContainer.value, | ||
| center: props.center as LngLatLike, | ||
| zoom: props.zoom, | ||
| style: { | ||
| glyphs: PROTOMAPS_GLYPHS_URL, | ||
| version: 8, | ||
| sources: { | ||
| 'carto': { | ||
| type: 'raster', | ||
| tiles: basemaps.carto.source.tiles, | ||
| }, | ||
| 'protomaps-base': grayscaleBasemap.source as any, | ||
|
||
| 'station-hubs': { | ||
| type: 'geojson', | ||
| data: { | ||
|
|
@@ -93,12 +93,7 @@ function initMap (): void { | |
| } | ||
| }, | ||
| layers: [ | ||
| { | ||
| id: 'carto', | ||
| source: 'carto', | ||
| type: 'raster', | ||
| ...basemaps.carto.layer | ||
| }, | ||
| ...layers('protomaps-base', GRAYSCALE), | ||
| { | ||
| id: 'station-hubs-fill', | ||
| type: 'fill', | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.