<div class="map-container">
<script>
var catalogUri = '{{ catalogUri }}';
var zoom = {{ city.zoom }};
var cityid = '{{ city.id }}';
var iCatalogPageId = '{{ iCatalogPageId }}';
var sCatalogUri = '{{ sCatalogUri }}';
var year = '{{ actYear }}';
var timePeriod = '{{ timePeriod }}';
var cat = '{{ cat }}';
var lat = '{{ city.latitude }}';
var lng = '{{ city.longitude }}';
var overlayImageUri = '{{ overlayImage }}';
var overlayLat1 = '{{ cityMap.overlay_latitude }}';
var overlayLng1 = '{{ cityMap.overlay_longitude }}';
var overlayLat2 = '{{ cityMap.overlay_bottom_latitude }}';
var overlayLng2 = '{{ cityMap.overlay_bottom_longitude }}';
var overlayZoom = parseInt('{{ cityMap.overlay_zoom }}');
var actOverlayObject = null;
var controlPanel = parseInt('{{ iControlPanel }}');
var webp = true;
function initialize() {
const newark = new google.maps.LatLng(lat, lng);
const myOptions = {
zoom: zoom,
maxZoom: 20,
minZoom: 13,
center: newark,
mapTypeId: google.maps.MapTypeId.ROADMAP,
mapTypeControl: false,
streetViewControl: false,
panControlOptions: {
position: google.maps.ControlPosition.TOP_RIGHT
},
zoomControlOptions: {
style: google.maps.ZoomControlStyle.LARGE,
position: google.maps.ControlPosition.TOP_LEFT
}
};
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
// deactivate restaurants ...
const styles = [
// {
// elementType: "geometry",
// stylers: [
// {
// color: "#212121"
// }
// ]
// },
// {
// elementType: "labels.icon",
// stylers: [
// {
// visibility: "off"
// }
// ]
// },
{
featureType: "poi",
stylers: [
{
visibility: "off"
}
]
}
];
map.setOptions({styles: styles});
overlayImageUri = '{{ overlayImage }}'; // 'files/design/meissen.jpg';
// cityid 1
// if (typeof overlayImageUri != 'undefined' && overlayImageUri != '' && overlayImageUri != 'files/pano_data/Staedte/Frauenstein/Stadtplaene/FS_Burg_Schloss_2014.png') {
if(cityid === '1') {
var tilePath = '{{ url }}/' + overlayImageUri.substring(0, overlayImageUri.length - 4),
tileExt = '.png';
/*if (typeof webp !== 'undefined') {
tilePath = tilePath + '_webp';
tileExt = '.webp'
}*/
var mapBounds = new google.maps.LatLngBounds(
new google.maps.LatLng(overlayLat2, overlayLng2),
new google.maps.LatLng(overlayLat1, overlayLng1));
var mapMinZoom = 13;
var mapMaxZoom = 20;
var imageMapType = new google.maps.ImageMapType({
getTileUrl: function (coord, zoom) {
var proj = map.getProjection();
var z2 = Math.pow(2, zoom);
var tileXSize = 256 / z2;
var tileYSize = 256 / z2;
var tileBounds = new google.maps.LatLngBounds(
proj.fromPointToLatLng(new google.maps.Point(coord.x * tileXSize, (coord.y + 1) * tileYSize)),
proj.fromPointToLatLng(new google.maps.Point((coord.x + 1) * tileXSize, coord.y * tileYSize))
);
var y = coord.y;
var x = coord.x >= 0 ? coord.x : z2 + coord.x
if (mapBounds.intersects(tileBounds) && (mapMinZoom <= zoom) && (zoom <= mapMaxZoom))
return tilePath + '/' + zoom + "/" + x + "/" + y + tileExt;
else
return tilePath + "/none.png";
}
});
map.overlayMapTypes.push(imageMapType);
actOverlayObject = imageMapType;
} else {
/* fallback frauenstein */
var imageBounds = new google.maps.LatLngBounds(
new google.maps.LatLng(overlayLat2, overlayLng2),
new google.maps.LatLng(overlayLat1, overlayLng1));
var overlayMap = new google.maps.GroundOverlay(
overlayImageUri,
imageBounds
);
overlayMap.setMap(map);
actOverlayObject = overlayMap;
}
/* for debug
map.addListener('zoom_changed', function() {
console.log('Zoom: ' + map.getZoom());
});
*/
if (controlPanel == 1) {
// @todo needed map.controls[google.maps.ControlPosition.TOP_LEFT].push(renderMapControlPanel());
}
;
google.maps.event.addListenerOnce(map, 'idle', function () {
google.maps.event.trigger(map, 'resize');
});
markerClusterOptions = {
gridSize: 30,
maxZoom: 17,
styles: [
{
height: 56,
width: 55,
url: "/typo3conf/ext/arstempano_design/Resources/Public/v2/images/map/m2.png"
}
]
};
markerCluster = new MarkerClusterer(map, [], markerClusterOptions);
// init Sidebar and MapController
Sidebar.init();
}
document.addEventListener("DOMContentLoaded", function () {
google.maps.event.addDomListener(window, 'load', initialize);
});
</script>
<div id="map_canvas" style="height:100%;weight:100%;"></div>
</div>