import { MapManager, type MapMarkerProperties } from '@arenarium/maps';
import { GoogleMapsProvider } from '@arenarium/maps-integration-google';
import '@arenarium/maps/style.css';
// Create a Google Maps provider instance
const provider = await GoogleMapsProvider.create({
container: document.getElementById('map')!,
// Other provider options
options: {
api: {
key: 'GOOGLE_MAPS_API_KEY',
v: 'weekly',
// Other google maps api options
},
map: {
mapId: 'GOOGLE_MAPS_MAP_ID',
// Other google maps options
}
}
});
// Create the map manager with the provider
const manager = await MapManager.create('AREANARIUM_MAPS_KEY', provider);
// Create markers
const markers = new Array<MapMarkerProperties>(getMarkerCount());
for (let i = 0; i < markers.length; i++) {
markers[i] = {
id: getId(i),
rank: getRank(i),
lat: getLatitude(i),
lng: getLongitude(i),
pin: {
element: getPinElement(i),
},
tooltip: {
element: getTooltipElement(i),
dimensions: getTooltipDimensions(i),
},
popup: {
element: getPopupElement(i),
dimensions: getPopupDimensions(i),
},
};
}
// Update the map with the new markers
await manager.updateMarkers(markers);