From 27fd1faa9c360b0283a24fe399bc5b03c6fb82a5 Mon Sep 17 00:00:00 2001 From: Eli Ribble Date: Fri, 3 Apr 2026 19:45:12 +0000 Subject: [PATCH] Get clean-building locator map --- ts/components/MapAggregate.vue | 4 +- ts/components/MapLocator.vue | 179 +++++++++++++++++++++++++++++++++ ts/map-utils.ts | 22 ++++ ts/rmo/content/Nuisance.vue | 31 +++++- ts/types.ts | 4 +- 5 files changed, 233 insertions(+), 7 deletions(-) create mode 100644 ts/components/MapLocator.vue create mode 100644 ts/map-utils.ts diff --git a/ts/components/MapAggregate.vue b/ts/components/MapAggregate.vue index d6597891..07ab6f05 100644 --- a/ts/components/MapAggregate.vue +++ b/ts/components/MapAggregate.vue @@ -27,8 +27,8 @@ diff --git a/ts/map-utils.ts b/ts/map-utils.ts new file mode 100644 index 00000000..4a4a1809 --- /dev/null +++ b/ts/map-utils.ts @@ -0,0 +1,22 @@ +import type { Marker } from "@/types"; +import { LngLat, LngLatBounds } from "maplibre-gl"; + +export function boundsMarkers(markers: Marker[]): LngLatBounds { + let min_lat = 90; + let min_lng = 180; + let max_lat = -90; + let max_lng = -180; + markers.forEach((marker: Marker) => { + min_lat = Math.min(marker.location.lat, min_lat); + min_lng = Math.min(marker.location.lng, min_lng); + max_lat = Math.min(marker.location.lat, max_lat); + max_lng = Math.min(marker.location.lng, max_lng); + }); + return new LngLatBounds( + new LngLat(min_lng, min_lat), + new LngLat(max_lng, max_lat), + ); +} +export function boundsDefault(): LngLatBounds { + return new LngLatBounds(new LngLat(-70, 50), new LngLat(-125, 25)); +} diff --git a/ts/rmo/content/Nuisance.vue b/ts/rmo/content/Nuisance.vue index dd7961a2..8433350a 100644 --- a/ts/rmo/content/Nuisance.vue +++ b/ts/rmo/content/Nuisance.vue @@ -156,7 +156,14 @@ select.tall { You can also click on the map to mark the location precisely

- +
@@ -502,16 +509,34 @@ select.tall { diff --git a/ts/types.ts b/ts/types.ts index 17bc4406..db90a6a0 100644 --- a/ts/types.ts +++ b/ts/types.ts @@ -89,8 +89,8 @@ export interface MapClickEvent { point: Point; } export interface Marker { - color: string; - draggable: boolean; + color?: string; + draggable?: boolean; id: string; location: Location; }