From 72e7fe92bdc35da3c8f81f8eb329273768b45a04 Mon Sep 17 00:00:00 2001 From: Jim Grimes Date: Thu, 6 Jun 2024 20:25:59 -0400 Subject: [PATCH] Added bounding box and filter to MapboxGeoCoder --- src/components/PropertyMap.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/components/PropertyMap.tsx b/src/components/PropertyMap.tsx index a31c6437..79cb440d 100644 --- a/src/components/PropertyMap.tsx +++ b/src/components/PropertyMap.tsx @@ -302,6 +302,15 @@ const PropertyMap: FC = ({ const center = map.getCenter(); geocoderRef.current = new MapboxGeocoder({ accessToken: mapboxAccessToken, + bbox: [-75.288283,39.864114,-74.945063,40.140129], + filter: function (item) { + return item.context.some((i) => { + return ( + (i.id.split('.').shift() === 'place' && i.text === 'Philadelphia') || + (i.id.split('.').shift() === 'district' && i.text === 'Philadelphia County') + ); + }); + }, mapboxgl: mapboxgl, marker: false, proximity: {