-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a very basic version of the walking map
- Loading branch information
1 parent
ab8f8f1
commit a65ef81
Showing
4 changed files
with
141 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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 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 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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import React from "react"; | ||
|
||
import { layers } from "./walking-map-layers.ts"; | ||
import { useMap, useMapZoom } from "../Map/MapUtils.ts"; | ||
|
||
export const WalkingMap: React.FC = () => { | ||
|
||
const map = useMap(); | ||
const zoom = useMapZoom(); | ||
|
||
// Add the walking layers to the map: | ||
React.useEffect(() => { | ||
if (!map) return; | ||
for (const layer of layers) { | ||
map.addLayer(layer); | ||
} | ||
return () => { | ||
for (const layer of layers) { | ||
map.removeLayer(layer.id); | ||
} | ||
} | ||
}); | ||
|
||
return <> | ||
<div className="absolute w-96 h-30 bg-white z-50 top-24 left-5 border border-gray-500 rounded shadow-md p-2"> | ||
The Transitopia walking map is not yet developed, but for now you can see | ||
all the known pedestrian paths from OpenStreetMap. | ||
</div> | ||
{ | ||
zoom < 14 ? | ||
<div className="absolute w-96 h-30 bg-white z-50 top-48 left-5 border border-gray-500 rounded shadow-md p-2 font-bold"> | ||
Zoom in to see walkways. | ||
</div> | ||
: null | ||
} | ||
</>; | ||
} |
This file contains 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 |
---|---|---|
@@ -0,0 +1,69 @@ | ||
// Transitopia Cycling map style for MapLibre GL | ||
// By Braden MacDonald | ||
// Code license: MIT (see repository's LICENSE file) | ||
// Design license: CC-BY 4.0 https://creativecommons.org/licenses/by/4.0/ | ||
|
||
import type { LayerSpecification } from "maplibre-gl"; | ||
import { defaultLineLayout, interpolateZoom } from "../Map/basemap-layers.ts"; | ||
|
||
// Changes from Positron: | ||
// - Noto Sans font is removed since our font server can only serve one font at a time - https://github.com/openmaptiles/fonts/issues/17 | ||
|
||
export const mapSource = "omt-transitopia"; | ||
|
||
|
||
export const layers: LayerSpecification[] = [ | ||
// TODO: pedestrian paths under construction | ||
// TODO: Various comfor levels of pedestrian paths | ||
{ | ||
// This includes pedestrian paths and cycling paths. | ||
// We show it on the base map but draw in front of it on the cycling and pedestrian maps | ||
id: "walking_path", | ||
type: "line", | ||
source: mapSource, | ||
"source-layer": "transportation", | ||
"filter": [ | ||
"all", | ||
["==", "$type", "LineString"], | ||
["==", "class", "path"], | ||
["!=", "subclass", "cycleway"], | ||
], | ||
layout: defaultLineLayout, | ||
"paint": { | ||
"line-color": "rgb(238, 165, 80)", | ||
// "line-opacity": 0.9, | ||
"line-width": interpolateZoom({ z13: 1, z20: 10 }), | ||
}, | ||
}, | ||
{ | ||
id: "walking_path_name", | ||
type: "symbol", | ||
source: mapSource, | ||
"source-layer": "transportation_name", | ||
"filter": [ | ||
"all", | ||
["!=", "class", "motorway"], | ||
["==", "$type", "LineString"], | ||
["==", "subclass", "path"], | ||
], | ||
"layout": { | ||
"symbol-placement": "line", | ||
"symbol-spacing": 350, | ||
"text-field": "{name:latin} {name:nonlatin}", | ||
"text-font": ["Metropolis Regular"], | ||
"text-max-angle": 30, | ||
"text-pitch-alignment": "viewport", | ||
"text-rotation-alignment": "map", | ||
"text-size": 10, | ||
"text-transform": "uppercase", | ||
"visibility": "visible", | ||
}, | ||
"paint": { | ||
"text-color": "rgb(50, 50, 50)", | ||
"text-halo-blur": 1, | ||
"text-halo-color": "rgba(238, 165, 80, 0.5)", | ||
"text-translate": [0, -10], | ||
"text-halo-width": 2, | ||
}, | ||
}, | ||
]; |