aboutsummaryrefslogtreecommitdiff
path: root/src/static
diff options
context:
space:
mode:
authoruser <user@node5.net>2024-04-07 03:03:16 +0200
committeruser <user@node5.net>2024-04-07 03:03:16 +0200
commit0ead8a6c32e55fb2989e932ff0d5a20f88809fd9 (patch)
treec7832f3a2f601e2f4f57b1914dde80888bd253dc /src/static
parentfa360829bfe3f04f3e6d9af196dc9fd480864d4b (diff)
show all stores, and their respective polygons
Diffstat (limited to 'src/static')
-rw-r--r--src/static/icons/365discount.pngbin0 -> 669 bytes
-rw-r--r--src/static/icons/Brugsen.pngbin0 -> 354 bytes
-rw-r--r--src/static/icons/Dagli'Brugsen.pngbin0 -> 285 bytes
-rw-r--r--src/static/icons/Føtex Food.pngbin0 -> 559 bytes
-rw-r--r--src/static/icons/Føtex.pngbin0 -> 556 bytes
-rw-r--r--src/static/icons/Kvickly.pngbin0 -> 437 bytes
-rw-r--r--src/static/icons/Lidl.pngbin0 -> 756 bytes
-rw-r--r--src/static/icons/Løvbjerg.pngbin0 -> 356 bytes
-rw-r--r--src/static/icons/Meny.pngbin0 -> 505 bytes
-rw-r--r--src/static/icons/Min Købmand.pngbin0 -> 260 bytes
-rw-r--r--src/static/icons/Netto.pngbin0 -> 754 bytes
-rw-r--r--src/static/icons/Rema 1000.pngbin0 -> 814 bytes
-rw-r--r--src/static/icons/Spar.pngbin0 -> 803 bytes
-rw-r--r--src/static/icons/SuperBrugsen.pngbin0 -> 423 bytes
-rw-r--r--src/static/icons/Unknown.pngbin0 -> 296 bytes
-rw-r--r--src/static/images/marker-icon.pngbin1466 -> 0 bytes
-rw-r--r--src/static/images/marker-shadow.pngbin618 -> 0 bytes
-rw-r--r--src/static/main.js50
18 files changed, 46 insertions, 4 deletions
diff --git a/src/static/icons/365discount.png b/src/static/icons/365discount.png
new file mode 100644
index 0000000..afc5c5b
--- /dev/null
+++ b/src/static/icons/365discount.png
Binary files differ
diff --git a/src/static/icons/Brugsen.png b/src/static/icons/Brugsen.png
new file mode 100644
index 0000000..5a36aa1
--- /dev/null
+++ b/src/static/icons/Brugsen.png
Binary files differ
diff --git a/src/static/icons/Dagli'Brugsen.png b/src/static/icons/Dagli'Brugsen.png
new file mode 100644
index 0000000..854c686
--- /dev/null
+++ b/src/static/icons/Dagli'Brugsen.png
Binary files differ
diff --git a/src/static/icons/Føtex Food.png b/src/static/icons/Føtex Food.png
new file mode 100644
index 0000000..6b0711a
--- /dev/null
+++ b/src/static/icons/Føtex Food.png
Binary files differ
diff --git a/src/static/icons/Føtex.png b/src/static/icons/Føtex.png
new file mode 100644
index 0000000..86c3f60
--- /dev/null
+++ b/src/static/icons/Føtex.png
Binary files differ
diff --git a/src/static/icons/Kvickly.png b/src/static/icons/Kvickly.png
new file mode 100644
index 0000000..81e3fee
--- /dev/null
+++ b/src/static/icons/Kvickly.png
Binary files differ
diff --git a/src/static/icons/Lidl.png b/src/static/icons/Lidl.png
new file mode 100644
index 0000000..f80f7f8
--- /dev/null
+++ b/src/static/icons/Lidl.png
Binary files differ
diff --git a/src/static/icons/Løvbjerg.png b/src/static/icons/Løvbjerg.png
new file mode 100644
index 0000000..6549a3e
--- /dev/null
+++ b/src/static/icons/Løvbjerg.png
Binary files differ
diff --git a/src/static/icons/Meny.png b/src/static/icons/Meny.png
new file mode 100644
index 0000000..5496f23
--- /dev/null
+++ b/src/static/icons/Meny.png
Binary files differ
diff --git a/src/static/icons/Min Købmand.png b/src/static/icons/Min Købmand.png
new file mode 100644
index 0000000..55bad2a
--- /dev/null
+++ b/src/static/icons/Min Købmand.png
Binary files differ
diff --git a/src/static/icons/Netto.png b/src/static/icons/Netto.png
new file mode 100644
index 0000000..50a8001
--- /dev/null
+++ b/src/static/icons/Netto.png
Binary files differ
diff --git a/src/static/icons/Rema 1000.png b/src/static/icons/Rema 1000.png
new file mode 100644
index 0000000..e73b99a
--- /dev/null
+++ b/src/static/icons/Rema 1000.png
Binary files differ
diff --git a/src/static/icons/Spar.png b/src/static/icons/Spar.png
new file mode 100644
index 0000000..cc88bb6
--- /dev/null
+++ b/src/static/icons/Spar.png
Binary files differ
diff --git a/src/static/icons/SuperBrugsen.png b/src/static/icons/SuperBrugsen.png
new file mode 100644
index 0000000..d7e6e88
--- /dev/null
+++ b/src/static/icons/SuperBrugsen.png
Binary files differ
diff --git a/src/static/icons/Unknown.png b/src/static/icons/Unknown.png
new file mode 100644
index 0000000..4209ecf
--- /dev/null
+++ b/src/static/icons/Unknown.png
Binary files differ
diff --git a/src/static/images/marker-icon.png b/src/static/images/marker-icon.png
deleted file mode 100644
index 950edf2..0000000
--- a/src/static/images/marker-icon.png
+++ /dev/null
Binary files differ
diff --git a/src/static/images/marker-shadow.png b/src/static/images/marker-shadow.png
deleted file mode 100644
index 9fd2979..0000000
--- a/src/static/images/marker-shadow.png
+++ /dev/null
Binary files differ
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: '&copy; <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