Skip to content

Commit

Permalink
fixes for marker appearing at geocoder search, replaced with popup
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanBirtch-aot committed Oct 16, 2024
1 parent 04a7d2f commit 5391c7d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 5 additions & 6 deletions components/src/components/Map/services/BCGeocoderProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -24,5 +23,5 @@ export class BCGeocoderProvider extends OpenStreetMapProvider {
raw: feature,
};
});
}
};
}
2 changes: 2 additions & 0 deletions components/src/components/Map/services/MapService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`)
Expand Down

0 comments on commit 5391c7d

Please sign in to comment.