From a1aa2b807bdad5cebfc8e473e860638f31eae420 Mon Sep 17 00:00:00 2001 From: GustavJones <75836198+GustavJones@users.noreply.github.com> Date: Sun, 4 Jan 2026 21:16:23 +0200 Subject: [PATCH] feat(web): Add coordinate pair location searching. (#24799) * feat(web): Add coordinate pair searching within the change location modal. Adds simple logic to try and parse a coordinate pair in the format `LATITUDE, LONGITUDE` as provided from Google Maps if a coordinate is copied to update the coordinates automatically. * Add checks for valid coordinate pairs * Update formatting and fix linting issues --- .../shared-components/change-location.svelte | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/web/src/lib/components/shared-components/change-location.svelte b/web/src/lib/components/shared-components/change-location.svelte index 0102e34977..57fcf9c98d 100644 --- a/web/src/lib/components/shared-components/change-location.svelte +++ b/web/src/lib/components/shared-components/change-location.svelte @@ -86,6 +86,27 @@ return; } + // Try to parse coordinate pair from search input in the format `LATITUDE, LONGITUDE` as floats + const coordinateParts = searchWord.split(',').map((part) => part.trim()); + if (coordinateParts.length === 2) { + const coordinateLat = Number.parseFloat(coordinateParts[0]); + const coordinateLng = Number.parseFloat(coordinateParts[1]); + + if ( + !Number.isNaN(coordinateLat) && + !Number.isNaN(coordinateLng) && + coordinateLat >= -90 && + coordinateLat <= 90 && + coordinateLng >= -180 && + coordinateLng <= 180 + ) { + places = []; + showLoadingSpinner = false; + handleUseSuggested(coordinateLat, coordinateLng); + return; + } + } + searchPlaces({ name: searchWord }) .then((searchResult) => { // skip result when a newer search is happening