From 5391c7d98f5d985b317a4c8e10c67638953a4055 Mon Sep 17 00:00:00 2001 From: RyanBirtch-aot Date: Wed, 16 Oct 2024 16:47:19 +0000 Subject: [PATCH] fixes for marker appearing at geocoder search, replaced with popup --- .../src/components/Map/services/BCGeocoderProvider.ts | 11 +++++------ components/src/components/Map/services/MapService.ts | 2 ++ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/components/src/components/Map/services/BCGeocoderProvider.ts b/components/src/components/Map/services/BCGeocoderProvider.ts index d8cae43b9..3fa9db72c 100644 --- a/components/src/components/Map/services/BCGeocoderProvider.ts +++ b/components/src/components/Map/services/BCGeocoderProvider.ts @@ -2,17 +2,16 @@ import { OpenStreetMapProvider } from 'leaflet-geosearch'; import { EndpointArgument } from 'leaflet-geosearch/dist/providers/provider'; export class BCGeocoderProvider extends OpenStreetMapProvider { - endpoint({ query, type }: EndpointArgument): string { - console.log(query); + endpoint = ({ query, type }: EndpointArgument): string => { return this.getUrl(import.meta.env.VITE_CHEFS_GEO_ADDRESS_APIURL, { addressString: query as string, }); - } - parse({ data }) { + }; + parse = ({ data }) => { return data.features .filter(function (feature) { if (!feature.geometry.coordinates) return false; - if (feature.properties.fullAddress == 'BC') return false; + if (feature.properties.fullAddress === 'BC') return false; return true; }) .map(function (feature) { @@ -24,5 +23,5 @@ export class BCGeocoderProvider extends OpenStreetMapProvider { raw: feature, }; }); - } + }; } diff --git a/components/src/components/Map/services/MapService.ts b/components/src/components/Map/services/MapService.ts index 3cccb849b..80197ea40 100644 --- a/components/src/components/Map/services/MapService.ts +++ b/components/src/components/Map/services/MapService.ts @@ -156,9 +156,11 @@ class MapService { provider: new BCGeocoderProvider(), style: 'bar', position: 'bottomleft', + showMarker: false, }); map.addControl(geocoderControl); map.on('geosearch/showlocation', (e) => { + console.log((e as any).location); L.popup() .setLatLng([(e as any).location.y, (e as any).location.x]) .setContent(`${(e as any).location.label}`)