{"id":1182,"date":"2026-04-14T10:22:45","date_gmt":"2026-04-14T10:22:45","guid":{"rendered":"https:\/\/nyiannios.sites.sch.gr\/wordpress\/?page_id=1182"},"modified":"2026-04-30T18:27:48","modified_gmt":"2026-04-30T18:27:48","slug":"goneis-map","status":"publish","type":"page","link":"https:\/\/nyiannios.sites.sch.gr\/wordpress\/goneis-map\/","title":{"rendered":"goneis map"},"content":{"rendered":"\r\n<div id=\"wpcode-map\" style=\"height:500px;width:100%;\"><\/div>\r\n\r\n<link rel=\"stylesheet\" href=\"https:\/\/unpkg.com\/leaflet@1.9.4\/dist\/leaflet.css\" \/>\r\n<link rel=\"stylesheet\" href=\"https:\/\/unpkg.com\/leaflet.markercluster@1.5.3\/dist\/MarkerCluster.css\" \/>\r\n<link rel=\"stylesheet\" href=\"https:\/\/unpkg.com\/leaflet.markercluster@1.5.3\/dist\/MarkerCluster.Default.css\" \/>\r\n\r\n<script src=\"https:\/\/unpkg.com\/leaflet@1.9.4\/dist\/leaflet.js\"><\/script>\r\n<script src=\"https:\/\/unpkg.com\/leaflet.markercluster@1.5.3\/dist\/leaflet.markercluster.js\"><\/script>\r\n\r\n<script src=\"https:\/\/www.gstatic.com\/firebasejs\/10.12.0\/firebase-app-compat.js\"><\/script>\r\n<script src=\"https:\/\/www.gstatic.com\/firebasejs\/10.12.0\/firebase-database-compat.js\"><\/script>\r\n\r\n<script>\r\nwindow.addEventListener(\"load\", function () {\r\n\r\n  firebase.initializeApp({\r\n    apiKey: \"AIzaSyAHT_f4DoCa6OrchSLVl-FwEylnY1TZ_po\",\r\n    authDomain: \"testfirebase1-d6623.firebaseapp.com\",\r\n    databaseURL: \"https:\/\/testfirebase1-d6623-default-rtdb.europe-west1.firebasedatabase.app\",\r\n    projectId: \"testfirebase1-d6623\"\r\n  });\r\n\r\n  const db = firebase.database();\r\n\r\n  const map = L.map(\"wpcode-map\");\r\n\r\n  const greeceBounds = [\r\n    [34.8, 19.3],\r\n    [41.8, 29.8]\r\n  ];\r\n\r\n  map.fitBounds(greeceBounds);\r\n\r\n  L.tileLayer(\"https:\/\/{s}.tile.openstreetmap.org\/{z}\/{x}\/{y}.png\", {\r\n    attribution: \"\u00a9 OpenStreetMap\"\r\n  }).addTo(map);\r\n\r\n  const markers = L.markerClusterGroup();\r\n  let first = null;\r\n\r\n  db.ref(\"locations\").on(\"value\", function(snapshot) {\r\n\r\n    markers.clearLayers();\r\n    first = null;\r\n\r\n    snapshot.forEach(function(child) {\r\n\r\n      const d = child.val();\r\n\r\n      if (d && d.lat != null && d.lng != null) {\r\n\r\n        if (!first) first = [Number(d.lat), Number(d.lng)];\r\n\r\n        markers.addLayer(\r\n          L.marker([d.lat, d.lng]).bindPopup(\r\n            \"<b>\" + (d.name || \"No name\") + \"<\/b>\"\r\n          )\r\n        );\r\n      }\r\n    });\r\n\r\n    map.addLayer(markers);\r\n\r\n    if (first) {\r\n      map.setView(first, 14);\r\n    } else {\r\n      map.fitBounds(greeceBounds);\r\n    }\r\n\r\n  });\r\n\r\n});\r\n<\/script>\r\n\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"_eb_attr":"","footnotes":""},"class_list":["post-1182","page","type-page","status-publish","hentry"],"acf":[],"_links":{"self":[{"href":"https:\/\/nyiannios.sites.sch.gr\/wordpress\/wp-json\/wp\/v2\/pages\/1182","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nyiannios.sites.sch.gr\/wordpress\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/nyiannios.sites.sch.gr\/wordpress\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/nyiannios.sites.sch.gr\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nyiannios.sites.sch.gr\/wordpress\/wp-json\/wp\/v2\/comments?post=1182"}],"version-history":[{"count":7,"href":"https:\/\/nyiannios.sites.sch.gr\/wordpress\/wp-json\/wp\/v2\/pages\/1182\/revisions"}],"predecessor-version":[{"id":1198,"href":"https:\/\/nyiannios.sites.sch.gr\/wordpress\/wp-json\/wp\/v2\/pages\/1182\/revisions\/1198"}],"wp:attachment":[{"href":"https:\/\/nyiannios.sites.sch.gr\/wordpress\/wp-json\/wp\/v2\/media?parent=1182"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}