aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/frontend/app/data/RegionConfig.ts15
-rw-r--r--src/frontend/app/routes/map.tsx19
-rw-r--r--src/frontend/public/maps/styles/openfreemap-any.json6
3 files changed, 33 insertions, 7 deletions
diff --git a/src/frontend/app/data/RegionConfig.ts b/src/frontend/app/data/RegionConfig.ts
index 0ce66e6..c3786ba 100644
--- a/src/frontend/app/data/RegionConfig.ts
+++ b/src/frontend/app/data/RegionConfig.ts
@@ -7,6 +7,11 @@ export interface RegionConfig {
estimatesEndpoint: string;
timetableEndpoint: string | null;
defaultCenter: [number, number]; // [lat, lng]
+ bounds?: {
+ sw: [number, number];
+ ne: [number, number];
+ };
+ textColour?: string;
defaultZoom: number;
showMeters: boolean; // Whether to show distance in meters
}
@@ -19,6 +24,11 @@ export const REGIONS: Record<RegionId, RegionConfig> = {
estimatesEndpoint: "/api/vigo/GetStopEstimates",
timetableEndpoint: "/api/vigo/GetStopTimetable",
defaultCenter: [42.229188855975046, -8.72246955783102],
+ bounds: {
+ sw: [-8.951059, 42.098923],
+ ne: [-8.447748, 42.3496]
+ },
+ textColour: "#e72b37",
defaultZoom: 14,
showMeters: true,
},
@@ -29,6 +39,11 @@ export const REGIONS: Record<RegionId, RegionConfig> = {
estimatesEndpoint: "/api/santiago/GetStopEstimates",
timetableEndpoint: null, // Not available for Santiago
defaultCenter: [42.8782, -8.5448],
+ bounds: {
+ sw: [-8.884454, 42.719102],
+ ne: [-8.243814, 43.02205]
+ },
+ textColour: "#6bb238",
defaultZoom: 14,
showMeters: false, // Santiago doesn't provide distance data
},
diff --git a/src/frontend/app/routes/map.tsx b/src/frontend/app/routes/map.tsx
index 88f4e52..29b097d 100644
--- a/src/frontend/app/routes/map.tsx
+++ b/src/frontend/app/routes/map.tsx
@@ -17,6 +17,7 @@ import { loadStyle } from "app/maps/styleloader";
import type { Feature as GeoJsonFeature, Point } from "geojson";
import { StopSheet } from "~/components/StopSheet";
import { useTranslation } from "react-i18next";
+import { REGIONS } from "~/data/RegionConfig";
// Default minimal fallback style before dynamic loading
const defaultStyle: StyleSpecification = {
@@ -142,6 +143,10 @@ export default function StopMap() {
zoom: mapState.zoom,
}}
attributionControl={false}
+ maxBounds={REGIONS[region].bounds ? [
+ REGIONS[region].bounds!.sw,
+ REGIONS[region].bounds!.ne,
+ ] : undefined}
>
<NavigationControl position="top-right" />
<GeolocateControl position="top-right" trackUserLocation={true} />
@@ -159,7 +164,7 @@ export default function StopMap() {
source="stops-source"
layout={{
"icon-image": `stop-${region}`,
- "icon-size": ["interpolate", ["linear"], ["zoom"], 11, 0.4, 18, 0.8],
+ "icon-size": ["interpolate", ["linear"], ["zoom"], 11, 0.7, 18, 1.0],
"icon-allow-overlap": true,
"icon-ignore-placement": true,
}}
@@ -172,16 +177,16 @@ export default function StopMap() {
minzoom={16}
layout={{
"text-field": ["get", "name"],
- "text-font": ["Noto Sans Regular"],
- "text-offset": [0, 2.5],
+ "text-font": ["Noto Sans Bold"],
+ "text-offset": [0, 3],
"text-anchor": "center",
"text-justify": "center",
- "text-size": ["interpolate", ["linear"], ["zoom"], 11, 8, 22, 14]
+ "text-size": ["interpolate", ["linear"], ["zoom"], 11, 8, 22, 16]
}}
paint={{
- "text-color": "#45a15a",
- "text-halo-color": "#fff",
- "text-halo-width": 1.5
+ "text-color": `${REGIONS[region].textColour || "#000"}`,
+ "text-halo-color": "#FFF",
+ "text-halo-width": 1
}}
/>
diff --git a/src/frontend/public/maps/styles/openfreemap-any.json b/src/frontend/public/maps/styles/openfreemap-any.json
index d279f8c..8fdca37 100644
--- a/src/frontend/public/maps/styles/openfreemap-any.json
+++ b/src/frontend/public/maps/styles/openfreemap-any.json
@@ -4394,6 +4394,12 @@
"filter": [
"all",
[
+ "!=",
+ [
+ "get",
+ "class"
+ ], "bus"],
+ [
"match",
[
"geometry-type"