{"id":6886,"date":"2025-08-13T17:23:01","date_gmt":"2025-08-13T15:23:01","guid":{"rendered":"https:\/\/2025.festivaldau.cat\/mapa\/"},"modified":"2025-10-16T17:40:56","modified_gmt":"2025-10-16T15:40:56","slug":"3d-map","status":"publish","type":"page","link":"https:\/\/2025.festivaldau.cat\/en\/3d-map\/","title":{"rendered":"3D Map"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-page\" data-elementor-id=\"6886\" class=\"elementor elementor-6886 elementor-5153\">\n\t\t\t\t<div class=\"elementor-element elementor-element-68afcef mapa-interactiu-header title-no-margin-bot e-flex e-con-boxed e-con e-parent\" data-id=\"68afcef\" data-element_type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-3d5704a elementor-widget elementor-widget-heading\" data-id=\"3d5704a\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">3D Map<\/h2>\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-6468956a e-flex e-con-boxed e-con e-parent\" data-id=\"6468956a\" data-element_type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-32139d17 elementor-widget elementor-widget-text-editor\" data-id=\"32139d17\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t\t\t\t\t\t\n\n<div id=\"gmap-wrapper\" class=\"\">\n  <!-- Placeholder per quan no hi ha consentiment -->\n  <div id=\"gmap-placeholder\">\n    <span>Accept cookies to see the map<\/span>\n    <button id=\"gmap-accept-btn\" class=\"cmplz-btn cmplz-accept\">\n      Accept cookies    <\/button>\n  <\/div>\n  <!-- El mapa real -->\n  <div id=\"gmap\"><\/div>\n<\/div>\n\n<script>\n\nfunction createPlaceholder() {\n\n\n  \/\/ bot\u00f3 acceptar\n  placeholder.querySelector('#gmap-accept-btn').addEventListener('click', function(){\n    if (typeof cmplz_accept_all === \"function\") {\n      cmplz_accept_all();\n      if (typeof cmplz_run_after_all_scripts === \"function\") {\n        cmplz_run_after_all_scripts();\n      }\n    }\n  });\n}\n\nfunction loadGoogleMaps() {\n  if (document.getElementById('gmaps-api')) return; \/\/ Evita carregar dues vegades\n  var s = document.createElement('script');\n  s.id = \"gmaps-api\";\n  s.src = \"https:\/\/maps.googleapis.com\/maps\/api\/js?key=AIzaSyBHLL69vkSDHWQIRUT5Sbt0yFLWFPUUo-U&v=weekly&libraries=maps,marker&callback=initMap\";\n  s.async = true;\n  s.defer = true;\n  s.setAttribute(\"data-cmplz\",\"ignore\"); \/\/ \ud83d\udc48 per assegurar que Complianz no el bloqueja\n  document.head.appendChild(s);\n}\n\n\nfunction activarMapa() {\n  document.getElementById('gmap-wrapper').classList.remove('gmap-placeholder');\n  document.getElementById('gmap-wrapper').classList.add('gmap-visible');\n  document.getElementById('gmap-placeholder').style.display = 'none';\n  loadGoogleMaps();\n}\n\n\n\/\/ Quan l\u2019usuari dona consentiment despr\u00e9s\ndocument.addEventListener(\"cmplz_event_marketing\", function(consent){\n  if (consent) activarMapa();\n});\n\n\n\n\n\/\/ Si ja hi ha consentiment al carregar\nif ( typeof cmplz_has_consent === \"function\" && cmplz_has_consent('marketing') ) {\n  activarMapa();\n} else {\n  createPlaceholder();\n}\n\n<\/script>\n\n\n<script>\nasync function initMap() {\n  const { Map } = await google.maps.importLibrary('maps');\n  const { AdvancedMarkerElement } = await google.maps.importLibrary('marker');\n\n  const map = new Map(document.getElementById(\"gmap\"), {\n    center: { lat: 41.433590575980446, lng: 2.191566764386084 },\n    zoom: 18,\n    tilt: 0,\n    heading: 190,\n    mapId: \"b13dcf21c821fc2a96f022a9\",   \/\/ <-- el Map ID d\u2019estil\n    mapTypeId: \"hybrid\",\n    fullscreenControl: true,\n    streetViewControl: false,\n    mapTypeControl: true\n  });\n\n\n  const markers = [\n    { lat: 41.4343710370316, lng: 2.191316080979877, \n      title: \"Biblioteca Ignasi Igl\u00e9sias\",\n      subtitle: \"Congr\u00e9s Professional\"\n    },\n    { lat: 41.434286865279944, lng: 2.1916746562674914, \n      title: \"Pla\u00e7a de Can Fabra\",\n      subtitle: \"Foodtrucks\"\n    },\n    { lat: 41.43445300446862, lng: 2.1915782613060344, \n      title: \"Pla\u00e7a de Can Fabra\",\n      subtitle: \"DAU Tradicional\"\n    },\n    { lat: 41.43353060188118, lng: 2.191803192141331, \n      title: \"Escola Can Fabra\",\n      subtitle: \"Dauet\"\n    },\n    { lat: 41.43364117738584, lng: 2.190472595787036, \n      title: \"Institut Mart\u00ed Pous\",\n      subtitle: \"Gran Dau\"\n    },\n    { lat: 41.433452176098434, lng: 2.191500102522859, \n      title: \"Ateneu L\u2019Harmonia\",\n      subtitle: \"DAU Beta\"\n    },\n    { lat: 41.43284125187963, lng: 2.190797945403431, \n      title: \"F\u00e0brica de Creaci\u00f3. Planta Baixa\",\n      subtitle: \"Gran DAU \/ Ludoteca Expert \/ Escoles al DAU\"\n    },\n    { lat: 41.432862795175275, lng: 2.19058798088138, \n      title: \"F\u00e0brica de Creaci\u00f3. 3r pis\",\n      subtitle: \"DAU Expert \/ DAU de Rol\"\n    },\n    { lat: 41.432649898471695, lng: 2.191196987475637, \n      title: \"Espai Castellers\",\n      subtitle: \"DAU Hist\u00f2ric\"\n    },\n    { lat: 41.433284819600644, lng: 2.191715314047837, \n      title: \"Pati de l\u2019Escola Can Fabra\",\n      subtitle: \"DAU Gegant\"\n    },\n    { lat: 41.432999595404176, lng: 2.192375553564859, \n      title: \"Can Fontanet\",\n      subtitle: \"DAU Tranquil\"\n    }\n  ];\n\n  const PIN_SVG = `\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"35\" height=\"49\" viewBox=\"0 0 35 48.999\" aria-hidden=\"true\" focusable=\"false\">\n    <g>\n        <path d=\"M17.5,0A17.378,17.378,0,0,0,0,17.149C0,30.012,17.5,49,17.5,49S35,30.012,35,17.149A17.378,17.378,0,0,0,17.5,0\" fill=\"#433173\"\/>\n        <path d=\"M28.966,43.193c-1.159-1.165-1.74-1.748-2.9-2.912l.488,2.912Zm.547-12.91c.371-.645.853-1.837-1.376-1.837H26.4c-.881,1.527-1.322,2.292-2.2,3.819h1.741a3.775,3.775,0,0,0,3.536-1.909q.02-.037.042-.073M40.56,40.567l-.224.39c-2.287,3.97-4.275,1.508-5.23-.151-.918-1.591-1.375-2.385-2.293-3.974l1.658-2.876,2.205,3.823c.563.977,1.385,1.777,2.226.318l0-.008a3.786,3.786,0,0,0-.183-3.863c-.881-1.53-1.323-2.294-2.205-3.824.665-1.149.995-1.725,1.658-2.876.916,1.591,1.375,2.385,2.293,3.976a8.835,8.835,0,0,1,.091,9.066M33.033,30.113l-.217.377a8.47,8.47,0,0,1-7.891,4.39H19.39c2.087-3.62,3.131-5.43,5.217-9.05h5.535c4.176,0,4.189,2.03,2.891,4.282m-9.977,8.095h3.728l8.678,8.466H32.427L31.074,45.31H26.924c.091.547.138.819.231,1.365H24.343c-.515-3.385-.773-5.078-1.288-8.466M44.8,36.4a.621.621,0,0,0-.074-.3L38.076,24.621a.219.219,0,0,0-.027-.04.606.606,0,0,0-.413-.245h-.008s0,0-.007,0l0,0a.25.25,0,0,0-.058-.006H24.3a.626.626,0,0,0-.511.295L17.176,36.094a.065.065,0,0,0-.009.015.21.21,0,0,0-.022.045.625.625,0,0,0,0,.482v0a.027.027,0,0,0,0,.009.008.008,0,0,0,0-.005.253.253,0,0,0,.024.053c0,.006.009.015.014.023l6.631,11.464a.638.638,0,0,0,.51.3H37.591a.173.173,0,0,0,.05,0,.613.613,0,0,0,.421-.235v0s.005,0,.006-.008l0,0a.464.464,0,0,0,.034-.047L44.721,36.7a.633.633,0,0,0,.073-.3\" transform=\"translate(-13.444 -19.132)\" fill=\"#fff\"\/>\n    <\/g>\n    <\/svg>\n    `.trim();\n\n  function createPinEl() {\n    const el = document.createElement('div');\n    el.className = 'dau-pin';\n    el.innerHTML = PIN_SVG;\n    \/\/ mida del pin en p\u00edxels (ajusta al teu gust)\n    el.style.width = '36px';\n    el.style.height = '50px';\n    \/\/ que la punta del pin coincideixi amb la coordenada (ancoratge visual):\n    \/\/ el.style.transform = 'translate(-50%, -100%)';\n    \/\/ permet fer clic al marker per\u00f2 no als fills\n    el.style.pointerEvents = 'auto';\n    el.firstElementChild && (el.firstElementChild.style.pointerEvents = 'none');\n    return el;\n  }\n\n  \/\/ 1) Una sola InfoWindow compartida (fora del loop)\n  const sharedIW = new google.maps.InfoWindow({ disableAutoPan: true });\n\n  \/\/ 2) Cada marker\n  markers.forEach(m => {\n    const markerEl = createPinEl();\n    const marker = new AdvancedMarkerElement({\n      map,\n      position: { lat: m.lat, lng: m.lng },\n      title: m.title,\n      content: markerEl\n    });\n\n    \n    marker.addListener('click', () => {\n      const html = `\n        <div class=\"info-window\">\n          <strong>${m.title}<\/strong><br>\n          <span class=\"subtitle\">${m.subtitle}<\/span><br>\n          <a href=\"https:\/\/www.google.com\/maps\/dir\/?api=1&#038;destination=${m.lat},${m.lng}\"\n            target=\"_blank\" rel=\"noopener\">How to get there<\/a>\n        <\/div>`;\n      sharedIW.setContent(html);\n      sharedIW.open({ anchor: marker, map });\n    });\n  });\n\n  \/\/ (opcional) tancar en clicar al mapa\n  map.addListener('click', () => sharedIW.close());\n  \n}\n<\/script>\n\n\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-defdd36 mapa-interactiu-header title-no-margin-bot e-flex e-con-boxed e-con e-parent\" data-id=\"defdd36\" data-element_type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-1a2e072 elementor-align-center elementor-widget elementor-widget-button\" data-id=\"1a2e072\" data-element_type=\"widget\" data-widget_type=\"button.default\">\n\t\t\t\t\t\t\t\t\t\t<a class=\"elementor-button elementor-button-link elementor-size-sm\" href=\"https:\/\/2025.festivaldau.cat\/en\/map\/\">\n\t\t\t\t\t\t<span class=\"elementor-button-content-wrapper\">\n\t\t\t\t\t\t\t\t\t<span class=\"elementor-button-text\">See Interactive Map<\/span>\n\t\t\t\t\t<\/span>\n\t\t\t\t\t<\/a>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>3D Map See Interactive Map<\/p>\n","protected":false},"author":6,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"footnotes":""},"class_list":["post-6886","page","type-page","status-publish","hentry"],"acf":[],"_links":{"self":[{"href":"https:\/\/2025.festivaldau.cat\/en\/wp-json\/wp\/v2\/pages\/6886","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/2025.festivaldau.cat\/en\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/2025.festivaldau.cat\/en\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/2025.festivaldau.cat\/en\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/2025.festivaldau.cat\/en\/wp-json\/wp\/v2\/comments?post=6886"}],"version-history":[{"count":5,"href":"https:\/\/2025.festivaldau.cat\/en\/wp-json\/wp\/v2\/pages\/6886\/revisions"}],"predecessor-version":[{"id":8558,"href":"https:\/\/2025.festivaldau.cat\/en\/wp-json\/wp\/v2\/pages\/6886\/revisions\/8558"}],"wp:attachment":[{"href":"https:\/\/2025.festivaldau.cat\/en\/wp-json\/wp\/v2\/media?parent=6886"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}