Reputation: 371
Geoapify search nearby places feature highlights the area that is located within the given result , i need to know how to add this feature to leaflet map so the given radius area containing nearby places is highlighted from another areas ,is there any solution to do this in react leaflet map ?
useEffect(() => {
const map = useMap();
L.circle([lat, lng], { radius: 200 }).addTo(map);
}, []);
const Map = () => {
return (
<MapContainer
center={center}
minZoom={1}
zoomControl={false}
>
<TileLayer
attribution='© <a href="http://osm.org/copyright"></a> contributors'
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
/>
</MapContainer>
);
};
Upvotes: 1
Views: 1197
Reputation: 11348
A way would be to use L.Donut and draw a circle with hole around the marker:
L.marker(map.getCenter()).addTo(map);
var donut = L.donut(map.getCenter(),{
radius: 20000000000000,
innerRadius: 100,
innerRadiusAsPercent: false,
color: '#000',
weight: 2,
}).addTo(map);
https://plnkr.co/edit/JX3VdzxnGXGoOerr
Upvotes: 3