LE SEDI
Trova la struttura più vicina
${loc.name}
`);
state.infowin.open(state.map,marker);
});
state.markers[i]=marker;
if(i===0 && !state.firstCentered){ state.map.setCenter(latLng); state.map.setZoom(16); state.firstCentered=true; }
}
function geocodeAll(){
const cacheKey='geo_cache_medcenter_v1'; let cache={}; try{cache=JSON.parse(localStorage.getItem(cacheKey)||'{}')}catch(e){}
LOCATIONS.forEach((loc,i)=>{
const cached=cache[loc.address];
if(cached){
const g=new google.maps.LatLng(cached.lat,cached.lng);
setMarker(loc,g,i);
}else{
setTimeout(()=>{
state.geocoder.geocode({address:loc.address},(res,status)=>{
if(status==='OK' && res[0]){
const g=res[0].geometry.location;
cache[loc.address]={lat:g.lat(),lng:g.lng()};
localStorage.setItem(cacheKey,JSON.stringify(cache));
setMarker(loc,g,i);
}
});
}, i*150);
}
});
}
window.initMap=function(){
state.map=new google.maps.Map(document.getElementById('map'),{
center:{lat:40.93,lng:14.15},
zoom:16,
gestureHandling:'greedy', // rotellina + pinch
scrollwheel:true, // rotellina abilitata
mapTypeControl:false,
streetViewControl:false,
styles:[{"featureType":"poi","stylers":[{"visibility":"off"}]},{"featureType":"transit","stylers":[{"visibility":"off"}]},{"featureType":"road","elementType":"labels.icon","stylers":[{"visibility":"off"}]},{"featureType":"water","stylers":[{"saturation":-10}]},{"featureType":"road","stylers":[{"saturation":-20}]},{"featureType":"administrative.locality","stylers":[{"visibility":"simplified"}]}]
});
state.infowin=new google.maps.InfoWindow();
state.geocoder=new google.maps.Geocoder();
buildList();
geocodeAll();
};
})();
${loc.address}
Indicazioni ›