Skip to content

Commit

Permalink
Added bounding box and filter to MapboxGeoCoder
Browse files Browse the repository at this point in the history
  • Loading branch information
jgrimes86 committed Jun 7, 2024
1 parent 930256b commit 72e7fe9
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/components/PropertyMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,15 @@ const PropertyMap: FC<PropertyMapProps> = ({
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: {
Expand Down

0 comments on commit 72e7fe9

Please sign in to comment.