diff options
| author | user <user@node5.net> | 2024-04-07 03:03:16 +0200 |
|---|---|---|
| committer | user <user@node5.net> | 2024-04-07 03:03:16 +0200 |
| commit | 0ead8a6c32e55fb2989e932ff0d5a20f88809fd9 (patch) | |
| tree | c7832f3a2f601e2f4f57b1914dde80888bd253dc /src/static | |
| parent | fa360829bfe3f04f3e6d9af196dc9fd480864d4b (diff) | |
show all stores, and their respective polygons
Diffstat (limited to 'src/static')
| -rw-r--r-- | src/static/icons/365discount.png | bin | 0 -> 669 bytes | |||
| -rw-r--r-- | src/static/icons/Brugsen.png | bin | 0 -> 354 bytes | |||
| -rw-r--r-- | src/static/icons/Dagli'Brugsen.png | bin | 0 -> 285 bytes | |||
| -rw-r--r-- | src/static/icons/Føtex Food.png | bin | 0 -> 559 bytes | |||
| -rw-r--r-- | src/static/icons/Føtex.png | bin | 0 -> 556 bytes | |||
| -rw-r--r-- | src/static/icons/Kvickly.png | bin | 0 -> 437 bytes | |||
| -rw-r--r-- | src/static/icons/Lidl.png | bin | 0 -> 756 bytes | |||
| -rw-r--r-- | src/static/icons/Løvbjerg.png | bin | 0 -> 356 bytes | |||
| -rw-r--r-- | src/static/icons/Meny.png | bin | 0 -> 505 bytes | |||
| -rw-r--r-- | src/static/icons/Min Købmand.png | bin | 0 -> 260 bytes | |||
| -rw-r--r-- | src/static/icons/Netto.png | bin | 0 -> 754 bytes | |||
| -rw-r--r-- | src/static/icons/Rema 1000.png | bin | 0 -> 814 bytes | |||
| -rw-r--r-- | src/static/icons/Spar.png | bin | 0 -> 803 bytes | |||
| -rw-r--r-- | src/static/icons/SuperBrugsen.png | bin | 0 -> 423 bytes | |||
| -rw-r--r-- | src/static/icons/Unknown.png | bin | 0 -> 296 bytes | |||
| -rw-r--r-- | src/static/images/marker-icon.png | bin | 1466 -> 0 bytes | |||
| -rw-r--r-- | src/static/images/marker-shadow.png | bin | 618 -> 0 bytes | |||
| -rw-r--r-- | src/static/main.js | 50 |
18 files changed, 46 insertions, 4 deletions
diff --git a/src/static/icons/365discount.png b/src/static/icons/365discount.png Binary files differnew file mode 100644 index 0000000..afc5c5b --- /dev/null +++ b/src/static/icons/365discount.png diff --git a/src/static/icons/Brugsen.png b/src/static/icons/Brugsen.png Binary files differnew file mode 100644 index 0000000..5a36aa1 --- /dev/null +++ b/src/static/icons/Brugsen.png diff --git a/src/static/icons/Dagli'Brugsen.png b/src/static/icons/Dagli'Brugsen.png Binary files differnew file mode 100644 index 0000000..854c686 --- /dev/null +++ b/src/static/icons/Dagli'Brugsen.png diff --git a/src/static/icons/Føtex Food.png b/src/static/icons/Føtex Food.png Binary files differnew file mode 100644 index 0000000..6b0711a --- /dev/null +++ b/src/static/icons/Føtex Food.png diff --git a/src/static/icons/Føtex.png b/src/static/icons/Føtex.png Binary files differnew file mode 100644 index 0000000..86c3f60 --- /dev/null +++ b/src/static/icons/Føtex.png diff --git a/src/static/icons/Kvickly.png b/src/static/icons/Kvickly.png Binary files differnew file mode 100644 index 0000000..81e3fee --- /dev/null +++ b/src/static/icons/Kvickly.png diff --git a/src/static/icons/Lidl.png b/src/static/icons/Lidl.png Binary files differnew file mode 100644 index 0000000..f80f7f8 --- /dev/null +++ b/src/static/icons/Lidl.png diff --git a/src/static/icons/Løvbjerg.png b/src/static/icons/Løvbjerg.png Binary files differnew file mode 100644 index 0000000..6549a3e --- /dev/null +++ b/src/static/icons/Løvbjerg.png diff --git a/src/static/icons/Meny.png b/src/static/icons/Meny.png Binary files differnew file mode 100644 index 0000000..5496f23 --- /dev/null +++ b/src/static/icons/Meny.png diff --git a/src/static/icons/Min Købmand.png b/src/static/icons/Min Købmand.png Binary files differnew file mode 100644 index 0000000..55bad2a --- /dev/null +++ b/src/static/icons/Min Købmand.png diff --git a/src/static/icons/Netto.png b/src/static/icons/Netto.png Binary files differnew file mode 100644 index 0000000..50a8001 --- /dev/null +++ b/src/static/icons/Netto.png diff --git a/src/static/icons/Rema 1000.png b/src/static/icons/Rema 1000.png Binary files differnew file mode 100644 index 0000000..e73b99a --- /dev/null +++ b/src/static/icons/Rema 1000.png diff --git a/src/static/icons/Spar.png b/src/static/icons/Spar.png Binary files differnew file mode 100644 index 0000000..cc88bb6 --- /dev/null +++ b/src/static/icons/Spar.png diff --git a/src/static/icons/SuperBrugsen.png b/src/static/icons/SuperBrugsen.png Binary files differnew file mode 100644 index 0000000..d7e6e88 --- /dev/null +++ b/src/static/icons/SuperBrugsen.png diff --git a/src/static/icons/Unknown.png b/src/static/icons/Unknown.png Binary files differnew file mode 100644 index 0000000..4209ecf --- /dev/null +++ b/src/static/icons/Unknown.png diff --git a/src/static/images/marker-icon.png b/src/static/images/marker-icon.png Binary files differdeleted file mode 100644 index 950edf2..0000000 --- a/src/static/images/marker-icon.png +++ /dev/null diff --git a/src/static/images/marker-shadow.png b/src/static/images/marker-shadow.png Binary files differdeleted file mode 100644 index 9fd2979..0000000 --- a/src/static/images/marker-shadow.png +++ /dev/null diff --git a/src/static/main.js b/src/static/main.js index 24d0edf..405f455 100644 --- a/src/static/main.js +++ b/src/static/main.js @@ -4,15 +4,46 @@ L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', { attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>' }).addTo(map); +let known_store_chains; +let icons = {}; + +async function fetchChains() { + const response = await fetch("chains"); + known_store_chains = await response.json(); + + icons["Unknown"] = L.icon({ + iconUrl: 'icons/Unknown.png', + iconSize: [10, 16], + iconAnchor: [16, 16], + }); + + for (let known_store_chain of known_store_chains) { + icons[known_store_chain] = L.icon({ + iconUrl: `icons/${known_store_chain}.png`, + iconAnchor: [8, 8], + }); + } + + fetchShops(); +} function addMarker(shop) { - L.marker([shop.lat, shop.long], {title: shop.name, }).addTo(map); + let icon; + + if (known_store_chains.includes(shop.brand)){ + icon = icons[shop.brand]; + } else { + icon = icons["Unknown"]; + } + + L.marker([shop.lat, shop.long], { + title: shop.name, + icon: icon, + }).addTo(map); } function addPolygon(polygon) { L.polygon(polygon, {color: 'red'}).addTo(map); - - console.log(polygon.coordinates) } @@ -22,11 +53,22 @@ async function fetchShops() { shops.forEach((shop) => addMarker(shop)); } -fetchShops() async function fetch_voronoi_polygons() { const response = await fetch("voronoi_polygons.json"); const voronoi_polygons = await response.json(); voronoi_polygons.forEach((polygon) => addPolygon(polygon)); } + +function update(){ + if (map.getZoom() >= 14){ + //console.log('update') + } +} + +map.on('moveend', function() { + update() +}); + +fetchChains() fetch_voronoi_polygons()
\ No newline at end of file |
