(function () {
var container = document.getElementById('popup2');
var content = document.getElementById('popup-content');
var closer = document.getElementById('popup-closer');
var overlay = new ol.Overlay({
element: container,
autoPan: true,
autoPanAnimation: {
duration: 250,
},
});
closer.onclick = function () {
overlay.setPosition(undefined);
closer.blur();
return false;
};
// PUNTI start ************************************************************************************
var style = [];
var vectorList_a = [];
var iconList = [];
style['691'] = {
'LineString': new ol.style.Style({
stroke: new ol.style.Stroke({
color: 'red',
width: 3,
}),
}),
'MultiLineString': new ol.style.Style({
stroke: new ol.style.Stroke({
color: 'red',
width: 3,
}),
}),
};
// GPX start
var vectorgpx = new ol.layer.Vector({
name: 'Sentiero dei Gas',
description: ' ',
source: new ol.source.Vector({
url: ['/files/gpx/track_P.gpx'],
radius: 0,
format: new ol.format.GPX()
}),
style: function (feature) {
return style['691'][feature.getGeometry().getType()];
},
});
vectorList_a.push(vectorgpx);
var iconLayer = new ol.layer.Vector({
source: new ol.source.Vector({
features: iconList,
}),
});
vectorList_a.push(iconLayer);
var vectorList_24 = [];
var iconList = [];
style['706'] = {
'Point': new ol.style.Style({
image: new ol.style.Circle({
fill: new ol.style.Fill({
color: 'rgba(255,255,0,0.6)',
}),
radius: 10,
stroke: new ol.style.Stroke({
color: '#ff0',
width: 1,
}),
}),
}),
'LineString': new ol.style.Style({
stroke: new ol.style.Stroke({
color: '#be6acd',
width: 3,
}),
}),
'MultiLineString': new ol.style.Style({
stroke: new ol.style.Stroke({
color: '#be6acd',
width: 3,
}),
}),
};
// GPX start
var t = new ol.Feature({
geometry: new ol.geom.Point(ol.proj.fromLonLat([10.645940182339, 45.66563927187])),
name: 'Chiesa di San Giorgio',
description: '
La chiesa di San Giorgio venne fondata in età medievale, lungo l’antica Strada Regia, su di un’altura che doveva accogliere il castello dei Pellacani. Sulla facciata è incastonato un capitello corinzio di epoca romana. Nell’abside, di origine quattrocentesca, sono custoditi la pala raffigurante San Giorgio che uccide il drago dipinta dal pittore salodiano Nicola Grisiani attorno al 1646/47 e un pregevole altare settecentesco in marmi policromi. Sotto la mensa dell’odierno altare è posizionata un’epigrafe romana dedicata a Lorenia Mercatilla. Nella navata si aprono due altari laterali, uno dei quali conserva la pregevole pala raffigurante la Pietà dipinta dal pittore veneto Andrea Celesti. Il volto della chiesa venne rifatto nel XVIII secolo e terminato nel 1752 (data riportata in facciata). L’intera navata è stata ridipinta nel corso del Novecento.'
});
t.setStyle(
new ol.style.Style({
image: new ol.style.Circle({
fill: new ol.style.Fill({
color: '#be6acd'
}),
radius: 8,
stroke: new ol.style.Stroke({
color: '#000000',
width: 1,
}),
}),
}),
);
iconList.push(t);
style['712'] = {
'Point': new ol.style.Style({
image: new ol.style.Circle({
fill: new ol.style.Fill({
color: 'rgba(255,255,0,0.6)',
}),
radius: 10,
stroke: new ol.style.Stroke({
color: '#ff0',
width: 1,
}),
}),
}),
'LineString': new ol.style.Style({
stroke: new ol.style.Stroke({
color: '#be6acd',
width: 3,
}),
}),
'MultiLineString': new ol.style.Style({
stroke: new ol.style.Stroke({
color: '#be6acd',
width: 3,
}),
}),
};
// GPX start
var t = new ol.Feature({
geometry: new ol.geom.Point(ol.proj.fromLonLat([10.630855041267, 45.656695606253])),
name: 'Chiesa di San Nicola',
description: '
La parrocchiale si trova sopra un piccolo cocuzzolo all’estremità nord di Cecina. Di origini medievali, fu restaurata da Pasino Gozio dei Boselli nel XVI secolo. All’interno si conserva il ritratto di un giovane del casato Boselli, risalente al Cinquecento e attribuito a Girolamo Pilotti. La chiesa fu ampliata con l’aggiunta di due cappelle laterali davanti alle quali si trovano le tombe della nobile famiglia degli Zuanelli, decorate dagli stemmi gentilizi. Il più suntuoso è quello dedicato alla Madonna con il Bambino, che conserva un affresco quattrocentesco, incluso in una cornice barocca in stucco. Di fronte si trova l’altare dedicato a Sant’Alipio con San Domenico e Filippo Neri realizzato nel 1701, che custodisce un dipinto del pittore veneziano Andrea Celesti (1637-1712 ca). Dello stesso autore sono anche le pale degli altri due altari più vicini al presbiterio, raffiguranti la Lapidazione di Santo Stefano e la Madonna in gloria tra i Santi Giovanni Battista, Lucia e Rocco.'
});
t.setStyle(
new ol.style.Style({
image: new ol.style.Circle({
fill: new ol.style.Fill({
color: '#be6acd'
}),
radius: 8,
stroke: new ol.style.Stroke({
color: '#000000',
width: 1,
}),
}),
}),
);
iconList.push(t);
var iconLayer = new ol.layer.Vector({
source: new ol.source.Vector({
features: iconList,
}),
});
vectorList_24.push(iconLayer);
// PUNTI end ************************************************************************************
var view = new ol.View({
center: ol.proj.transform([10.600677, 45.648558], 'EPSG:4326', 'EPSG:3857'),
//maxZoom: 18,
zoom: 14
})
var map = new ol.Map({
//controls: ol.control.defaults().extend([new ol.control.FullScreen()]),
target: 'map',
overlays: [overlay],
layers: [
// LAYOUT DELLA CARTINA
new ol.layer.Group({
title: 'Visualizza', // A layer must have a title to appear in the layerswitcher
layers: [
new ol.layer.Group({
title: 'Terreno', // A layer must have a title to appear in the layerswitcher
type: 'base', // Setting the layers type to 'base' results in it having a radio button and only one base layer being visibile at a time
combine: true, // Setting combine to true causes sub-layers to be hidden in the layerswitcher, only the parent is shown
visible: false,
layers: [
new ol.layer.Tile({
source: new ol.source.Stamen({
layer: 'terrain'
})
})
]
}),
new ol.layer.Tile({
title: 'Curve di livello',
type: 'base',
source: new ol.source.XYZ({
attributions: 'Tiles © ArcGIS',
url: 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}',
}),
}),
new ol.layer.Tile({
title: 'Satellite',
type: 'base',
source: new ol.source.XYZ({
attributions: 'Tiles © Esri — Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community',
url: 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}.jpg',
maxZoom: 19,
}),
}),
new ol.layer.Tile({
title: 'Mappa', // A layer must have a title to appear in the layerswitcher
type: 'base', // Again set this layer as a base layer
visible: true,
source: new ol.source.OSM()
}),
]
}),
new ol.layer.Group({
title: 'Sentiero dei Gas',
fold: 'open', // Adding a 'fold' property set to either 'open' or 'close' makes the group layer collapsible
layers: [
new ol.layer.Group({
title: '
' + feature.get('description') + '
' + hdms + '';
overlay.setPosition(coordinate);
}
});
// POPOUP end ************************************************************************************
// Get out-of-the-map div element with the ID "layers" and renders layers to it.
// NOTE: If the layers are changed outside of the layer switcher then you
// will need to call ol.control.LayerSwitcher.renderPanel again to refesh
// the layer tree. Style the tree via CSS.
var sidebar = new ol.control.Sidebar({
element: 'sidebar',
position: 'left'
});
var toc = document.getElementById('layers');
ol.control.LayerSwitcher.renderPanel(map, toc, { reverse: true });
map.addControl(sidebar);
})();