Initial commit: Laadpalenviewer
Static-generation EV charging map for the Netherlands with two layers (passenger / logistics-freight), per-municipality crop-outs, and gemeente + province boundaries from PDOK/CBS. - data-pipeline/ (Node/TS): NDW OCPI download + classify (freight >=350kW / MCS / megawatt / Milence,WattHub) + external sources (curated, OCM, EAFO) + PDOK CBS boundaries -> static GeoJSON/JSON. - webapp/ (Next.js 16 + React 19 + deck.gl + MapLibre): national view loads all points without details; selecting a gemeente eagerly loads its detail bundle (OCPI EVSE/connector/tariff + status) for instant marker clicks. Passenger colored by OCPI status (fleetsim-style), freight amber/megawatt. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
// Color palettes for the deck.gl layers and legend.
|
||||
import type { AggregateStatus } from "@/types/charging";
|
||||
|
||||
export type RGBA = [number, number, number, number];
|
||||
|
||||
// Passenger points: colored by OCPI status (fleetsim-style).
|
||||
export const STATUS_AVAILABLE: RGBA = [34, 197, 94, 210]; // green-500
|
||||
export const STATUS_CHARGING: RGBA = [59, 130, 246, 210]; // blue-500
|
||||
export const STATUS_UNAVAILABLE: RGBA = [239, 68, 68, 210]; // red-500
|
||||
export const STATUS_UNKNOWN: RGBA = [107, 114, 128, 200]; // gray-500
|
||||
|
||||
// Freight points: amber/orange; megawatt = red-orange.
|
||||
export const FREIGHT: RGBA = [245, 158, 11, 235]; // amber-500
|
||||
export const FREIGHT_MEGAWATT: RGBA = [234, 88, 12, 245]; // orange-600
|
||||
|
||||
export const BOUNDARY_LINE: RGBA = [79, 70, 229, 200]; // indigo-600
|
||||
|
||||
export function statusColor(status: AggregateStatus): RGBA {
|
||||
switch (status) {
|
||||
case "AVAILABLE":
|
||||
return STATUS_AVAILABLE;
|
||||
case "CHARGING":
|
||||
return STATUS_CHARGING;
|
||||
case "UNAVAILABLE":
|
||||
return STATUS_UNAVAILABLE;
|
||||
default:
|
||||
return STATUS_UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
export function freightColor(isMegawatt: boolean): RGBA {
|
||||
return isMegawatt ? FREIGHT_MEGAWATT : FREIGHT;
|
||||
}
|
||||
|
||||
// Hex equivalents for legend / UI swatches.
|
||||
export const LEGEND = {
|
||||
available: "#22c55e",
|
||||
charging: "#3b82f6",
|
||||
unavailable: "#ef4444",
|
||||
unknown: "#6b7280",
|
||||
freight: "#f59e0b",
|
||||
freightMegawatt: "#ea580c",
|
||||
boundary: "#4f46e5",
|
||||
};
|
||||
@@ -0,0 +1,62 @@
|
||||
// Human-readable labels for OCPI connector/EVSE fields.
|
||||
// Lifted from fleetsim's ChargingPointsMapDeck helpers.
|
||||
|
||||
const CONNECTOR_LABELS: Record<string, string> = {
|
||||
IEC_62196_T2: "Type 2",
|
||||
IEC_62196_T2_COMBO: "CCS (Type 2 Combo)",
|
||||
CHADEMO: "CHAdeMO",
|
||||
DOMESTIC_A: "Schuko",
|
||||
DOMESTIC_F: "Type F (Schuko)",
|
||||
DOMESTIC_G: "Type G (UK)",
|
||||
IEC_60309_2_single_16: "IEC 60309 (16A)",
|
||||
IEC_60309_2_three_16: "IEC 60309 3-fase (16A)",
|
||||
IEC_60309_2_three_32: "IEC 60309 3-fase (32A)",
|
||||
IEC_60309_2_three_64: "IEC 60309 3-fase (64A)",
|
||||
TESLA_S: "Tesla (Type 2)",
|
||||
IEC_63379: "MCS (Megawatt)",
|
||||
};
|
||||
|
||||
export function formatConnectorStandard(standard: string): string {
|
||||
if (CONNECTOR_LABELS[standard]) return CONNECTOR_LABELS[standard];
|
||||
if (standard?.toUpperCase().startsWith("MCS")) return "MCS (Megawatt)";
|
||||
return standard;
|
||||
}
|
||||
|
||||
const POWER_TYPE_LABELS: Record<string, string> = {
|
||||
AC_1_PHASE: "AC 1-fase",
|
||||
AC_3_PHASE: "AC 3-fase",
|
||||
DC: "DC",
|
||||
};
|
||||
|
||||
export function formatPowerType(powerType: string): string {
|
||||
return POWER_TYPE_LABELS[powerType] || powerType;
|
||||
}
|
||||
|
||||
export function statusColorClass(status: string): string {
|
||||
switch (status) {
|
||||
case "AVAILABLE":
|
||||
return "bg-green-500";
|
||||
case "CHARGING":
|
||||
return "bg-blue-500";
|
||||
case "BLOCKED":
|
||||
return "bg-orange-500";
|
||||
case "OUTOFORDER":
|
||||
return "bg-red-500";
|
||||
case "RESERVED":
|
||||
return "bg-purple-500";
|
||||
default:
|
||||
return "bg-gray-500";
|
||||
}
|
||||
}
|
||||
|
||||
export function statusLabel(status: string): string {
|
||||
const labels: Record<string, string> = {
|
||||
AVAILABLE: "Beschikbaar",
|
||||
CHARGING: "Bezet",
|
||||
BLOCKED: "Geblokkeerd",
|
||||
OUTOFORDER: "Buiten dienst",
|
||||
RESERVED: "Gereserveerd",
|
||||
UNKNOWN: "Onbekend",
|
||||
};
|
||||
return labels[status] || status;
|
||||
}
|
||||
Reference in New Issue
Block a user