-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/** | ||
* administrative unit schema: | ||
{ | ||
name: string; | ||
description: string|null, | ||
image: string|null, | ||
lat: number; | ||
lng: number; | ||
address: string; | ||
chairman: string|null; | ||
website: string|null; | ||
email: string|null; | ||
isOfTypeClub: boolean; | ||
isOfTypeBase: boolean; | ||
isOfTypeRegional: boolean; | ||
isOfTypeOffice: boolean; | ||
isOfTypeChildren: boolean; | ||
} | ||
*/ | ||
|
||
async function hb_initialize_map() { | ||
const { Map } = await google.maps.importLibrary("maps"); | ||
const { AdvancedMarkerElement } = await google.maps.importLibrary("marker"); | ||
|
||
const mapEl = document.getElementById("map-v2"); | ||
const administrativeUnits = JSON.parse(mapEl.getAttribute('data-administrativeUnits')); | ||
|
||
const map = new Map(mapEl, { | ||
center: { lat: 49.000, lng: 16.000 }, | ||
zoom: 8, | ||
}); | ||
|
||
// todo bulk add? | ||
for (const unit of administrativeUnits) { | ||
const marker = new AdvancedMarkerElement({ | ||
map: map, | ||
position: { lat: unit.lat, lng: unit.lng }, | ||
title: unit.name, | ||
}); | ||
} | ||
} | ||
|
||
hb_initialize_map(); |