我想在我的谷歌地图中实现 MarkerClusterer。有没有我可以使用的库或组件。谢谢你。这就是我的代码现在的样子。谢谢你。
const handleApiLoaded = ({ map, maps }: MapProps) => {
console.log(maps);
mapRef.current = { map, maps };
if (truckData.length > 0) {
const bounds = getBounds(maps);
map.fitBounds(bounds);
bindResizeListener(map, maps, bounds);
}
};
<GoogleMapReact
bootstrapURLKeys={{ key: `${process.env.REACT_APP_GOOGLE_MAPS_KEY}` }}
center={mapCenter}
defaultZoom={14}
options={{ zoomControlOptions: { position: 7 } }}
layerTypes={isTraffic ? ["TrafficLayer"] : []}
yesIWantToUseGoogleMapApiInternals
onGoogleApiLoaded={handleApiLoaded}
>
</<GoogleMapReact>
interface MapProps {
map: google.maps.Map;
maps: {
LatLngBounds: new () => google.maps.LatLngBounds;
};
如何将标记聚类与 google-map-react 库一起使用。谢谢