/* UTILITY FUNCTIONS */ //function writeScale() { // var d = document.getElementById('info'); // d.innerHTML = this.getResolution(); //} function mergeStyle(style, base_style) { for(i in base_style) { var mode = base_style[i]; for(k in mode) { if(!style[i][k]) style[i][k] = mode[k]; } } return new OpenLayers.StyleMap(style); } /* GLOBAL OPTIONS */ OpenLayers.Console.error = function(txt) { alert(txt); } OpenLayers.Events.prototype.includeXY = true; OpenLayers.Util.onImageLoadError = function() { this.src = "img/empty.png"; } var map = null; var format = null; var wkt = null; var baseLayers = null; var layers = new Object; var edit; var edit_select; var selectControl; var highlightCtrl; var current_rischio; var proposte_loaded = false; //Ugly hack. var rischi = { names: { r_tot:'totale', r_antr:'antropico', r_disc:'discariche', r_estr: 'aree_estrattive', r_ferr: 'rete ferroviaria', r_frane: 'frane', r_ind: 'aree industriali', r_piene: 'piene', r_stab: 'stabilimenti', r_strade: 'rete_stradale' }, intervals: { r_tot: [187.89, 754.63, 1742.05], r_antr: [21.36,100.27,266.78], r_disc: [3,12,49], r_estr: [23.57,81.38,188.36], r_ferr: [48.00,184.27,494.46], r_frane: [33.79,139.45,463.71], r_ind: [21.82,81.38,188.36], r_piene: [15.69,53.58,156.10], r_stab: [4.15,16.43,32.79], r_strade: [122.00,520.12,1381.57] }, colors: ['#00cc33', '#dddd00', '#ff9900','#cc3300'] }; var controls = null; var popup = null; function init() { var options = { projection: new OpenLayers.Projection("EPSG:900913"), //displayProjection: new OpenLayers.Projection("EPSG:32632"), units: "m", maxResolution: 156543.0339, //maxResolution: 99.22366015624993, maxExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34, 20037508.34, 20037508.34) }; /* MAP CREATION AND CONTROLS */ map = new OpenLayers.Map('map', options); var panzoom = new OpenLayers.Control.PanZoomBar({slideFactor: 200}); panzoom.zoomWorldIcon = true; map.addControl(panzoom); map.removeControl (map.controls [1]); //Pannello di zoom e pan con stile personalizzato (olControlNavToolbar_aumi) //in maniera da inserire le icone custom OpenLayers.Control.CustomNavToolbar = OpenLayers.Class(OpenLayers.Control.Panel, { /** * Constructor: OpenLayers.Control.NavToolbar * Add our two mousedefaults controls. * * Parameters: * options - {Object} An optional object whose properties will be used to extend the control. */ initialize: function(options) { OpenLayers.Control.Panel.prototype.initialize.apply(this, [options]); this.addControls([ new OpenLayers.Control.Navigation({dblclick:false, active:true}), //Here it come new OpenLayers.Control.ZoomBox({alwaysZoom:true}), new OpenLayers.Control.Button({ displayClass: 'Print', type: OpenLayers.Control.TYPE_TOOL, eventListeners: { 'activate': function(){ //alert('Control of OpenLayers.Control.TYPE_TOGGLE type is activated') stampaMappaCorrente(); var navCtrls = map.getControlsByClass('OpenLayers.Control.Navigation'); for (var i = 0; i < navCtrls.length; i++) { navCtrls[i].activate(); } var navCtrls = map.getControlsByClass('OpenLayers.Control.Button'); for (var i = 0; i < navCtrls.length; i++) { navCtrls[i].deactivate(); } }, 'deactivate': function(){ //alert('Control of OpenLayers.Control.TYPE_TOGGLE type is deactivated') } } }) ]); // To make the custom navtoolbar use the regular navtoolbar style this.displayClass = 'olControlNavToolbar_aumi' }, /** * Method: draw * calls the default draw, and then activates mouse defaults. */ draw: function() { var div = OpenLayers.Control.Panel.prototype.draw.apply(this, arguments); this.activateControl(this.controls[0]); return div; } } ); var panel = new OpenLayers.Control.CustomNavToolbar({position: new OpenLayers.Pixel(15,50)}); map.addControl(panel); //REMOVE ME [debug to visualize resolution //map.events.register('zoomend', map, writeScale); //map.addControl(new OpenLayers.Control.KeyboardDefaults()); //map.addControl(new OpenLayers.Control.LayerSwitcher()); var external_control = new OpenLayers.Control.MousePosition({ div: document.getElementById('location') }); map.addControl(external_control); var navCtrls = map.getControlsByClass('OpenLayers.Control.Navigation'); for (var i = 0; i < navCtrls.length; i++) { navCtrls[i].disableZoomWheel(); } //visualizza scala: var scaleControl = map.addControl(new OpenLayers.Control.Scale(null, { updateScale: function() { var scale = map.getScale(); //alert("scale=" + scale); if (scale) { document.getElementById('scale').innerHTML = "1 : " + OpenLayers.Number.format(Math.round(scale), 0, "."); } } })); //scalebar var scalebar = new OpenLayers.Control.ScaleBar({ div: document.getElementById("scalebar"), minWidth: 75, maxWidth: 175 }); map.addControl(scalebar); // OpenStreetMap var openstreetmap = new OpenLayers.Layer.OSM.Mapnik("OSM", {isBaseLayer:true, displayInLayerSwitcher:true, numZoomLevels: 20}); map.addLayer(openstreetmap); /* GOOGLE MAPS */ var gmap = new OpenLayers.Layer.Google( "Google Streets", {numZoomLevels: 20} ); var gphy = new OpenLayers.Layer.Google( "Google Physical", {type: google.maps.MapTypeId.TERRAIN} );//lo uso solo per "nessuna base" e per mantenere la scala. var ghyb = new OpenLayers.Layer.Google( "Google Hybrid", {type: google.maps.MapTypeId.HYBRID, numZoomLevels: 20} ); var gsat = new OpenLayers.Layer.Google( "Google Satellite", {type: google.maps.MapTypeId.SATELLITE, numZoomLevels: 20} ); map.addLayers([gmap, ghyb, gsat, gphy]); ghyb.setVisibility(false); gsat.setVisibility(false); /* SITAP BASE CARTOGRAPHY */ var igm250000 = new OpenLayers.Layer.WMS( "igm 250000", "http://sitap.beniculturali.it:8080/geoserver/wms", { LAYERS: 'apar:CB.IGM250000', STYLES: '', format: 'image/png', transparent: 'true' }, { ratio: 1, displayOutsideMaxExtent: true, isBaseLayer: false, 'visibility': true, projection: new OpenLayers.Projection("EPSG:900913") } ); map.addLayer(igm250000); igm250000.setVisibility(false); var igm100000 = new OpenLayers.Layer.WMS( "igm 100000", "http://sitap.beniculturali.it:8080/geoserver/wms", { LAYERS: 'apar:MB.IGM100000', STYLES: '', format: 'image/png', transparent: 'true' }, { ratio: 1, displayOutsideMaxExtent: true, isBaseLayer: false, 'visibility': true, projection: new OpenLayers.Projection("EPSG:900913") } ); map.addLayer(igm100000); igm100000.setVisibility(false); var igm25000 = new OpenLayers.Layer.WMS( "igm 25000", "http://sitap.beniculturali.it:8080/geoserver/wms", { LAYERS: 'apar:CB.IGM25000', STYLES: '', format: 'image/png', transparent: 'true' }, { ratio: 1, displayOutsideMaxExtent: true, isBaseLayer: false, 'visibility': true, projection: new OpenLayers.Projection("EPSG:900913") } ); map.addLayer(igm25000); igm25000.setVisibility(false); /* ************************************* WMS REGIONALI ************************************* */ // WMS Abruzzo CTR var abruzzo_ctr_wms = new OpenLayers.Layer.WMS( "sf:abruzzo_ctr", "http://2.42.228.54:8080/geoserver/sf/wms", { LAYERS: 'sf:abruzzo_ctr', STYLES: '', format: 'image/png', transparent: 'true' }, { ratio: 1, displayOutsideMaxExtent: true, isBaseLayer: false, 'visibility': true, projection: new OpenLayers.Projection("EPSG:900913") } ); map.addLayer(abruzzo_ctr_wms); abruzzo_ctr_wms.setVisibility(false); // WMS Emilia Romagna var emiliaromagna_ctr_wms = new OpenLayers.Layer.WMS( "apar_wms:DBTR2013_Ctr5", "http://sitap.beniculturali.it:8080/geoserver/apar_wms/wms", { LAYERS: 'apar_wms:DBTR2013_Ctr5', STYLES: '', format: 'image/png', transparent: 'true' }, { ratio: 1, displayOutsideMaxExtent: true, isBaseLayer: false, 'visibility': true, projection: new OpenLayers.Projection("EPSG:900913") } ); map.addLayer(emiliaromagna_ctr_wms); emiliaromagna_ctr_wms.setVisibility(false); // WMS Lazio var lazio_ctr_wms = new OpenLayers.Layer.WMS( "hub:5000_Mosaico_CTR5K_EPSG3004.ecw", "http://2.42.228.54/geoserver/hub/wms", { LAYERS: 'hub:5000_Mosaico_CTR5K_EPSG3004.ecw', STYLES: '', format: 'image/png', transparent: 'true' }, { ratio: 1, displayOutsideMaxExtent: true, isBaseLayer: false, 'visibility': true, projection: new OpenLayers.Projection("EPSG:900913") } ); map.addLayer(lazio_ctr_wms); lazio_ctr_wms.setVisibility(false); // WMS Liguria var liguria_ctr_wms = new OpenLayers.Layer.WMS( "apar_wms:C1237", "http://sitap.beniculturali.it:8080/geoserver/apar_wms/wms", { LAYERS: 'apar_wms:C1237', STYLES: '', format: 'image/png', transparent: 'true' }, { ratio: 1, displayOutsideMaxExtent: true, isBaseLayer: false, 'visibility': true, projection: new OpenLayers.Projection("EPSG:900913") } ); map.addLayer(liguria_ctr_wms); liguria_ctr_wms.setVisibility(false); // WMS Lombardia var lombardia_ctr_wms = new OpenLayers.Layer.WMS( "apar_wms:lombardia_ctr_10000", "http://2.42.228.54:8080/geoserver/sf/wms", { LAYERS: 'sf:lombardia_ctr_10000', STYLES: '', format: 'image/png', transparent: 'true' }, { ratio: 1, displayOutsideMaxExtent: true, isBaseLayer: false, 'visibility': true, projection: new OpenLayers.Projection("EPSG:900913") } ); map.addLayer(lombardia_ctr_wms); lombardia_ctr_wms.setVisibility(false); // WMS Molise var molise_ctr_wms = new OpenLayers.Layer.WMS( "apar_wms:molise_ctr", "http://sitap.beniculturali.it:8080/geoserver/apar_wms/wms", { LAYERS: 'apar_wms:molise_ctr', STYLES: '', format: 'image/png', transparent: 'true' }, { ratio: 1, displayOutsideMaxExtent: true, isBaseLayer: false, 'visibility': true, projection: new OpenLayers.Projection("EPSG:900913") } ); map.addLayer(molise_ctr_wms); molise_ctr_wms.setVisibility(false); // WMS Piemonte var piemonte_ctr_wms = new OpenLayers.Layer.WMS( "apar_wms:piemonte_ctr", "http://sitap.beniculturali.it:8080/geoserver/apar_wms/wms", { LAYERS: 'apar_wms:piemonte_ctr', STYLES: '', format: 'image/png', transparent: 'true' }, { ratio: 1, displayOutsideMaxExtent: true, isBaseLayer: false, 'visibility': true, projection: new OpenLayers.Projection("EPSG:900913") } ); map.addLayer(piemonte_ctr_wms); piemonte_ctr_wms.setVisibility(false); // WMS Sicilia var sicilia_ctr_wms = new OpenLayers.Layer.WMS( "apar_wms:sicilia_ctr", "http://sitap.beniculturali.it:8080/geoserver/apar_wms/wms", { LAYERS: 'apar_wms:sicilia_ctr', STYLES: '', format: 'image/png', transparent: 'true' }, { ratio: 1, displayOutsideMaxExtent: true, isBaseLayer: false, 'visibility': true, projection: new OpenLayers.Projection("EPSG:900913") } ); map.addLayer(sicilia_ctr_wms); sicilia_ctr_wms.setVisibility(false); // WMS Toscana var toscana_ctr_wms = new OpenLayers.Layer.WMS( "apar_wms:toscana_ctr_10k", "http://sitap.beniculturali.it:8080/geoserver/apar_wms/wms", { LAYERS: 'apar_wms:toscana_ctr_10k', STYLES: '', format: 'image/png', transparent: 'true' }, { ratio: 1, displayOutsideMaxExtent: true, isBaseLayer: false, 'visibility': true, projection: new OpenLayers.Projection("EPSG:900913") } ); map.addLayer(toscana_ctr_wms); toscana_ctr_wms.setVisibility(false); // WMS Toscana var toscana_ctr_wms = new OpenLayers.Layer.WMS( "apar_wms:toscana_ctr_10k", "http://sitap.beniculturali.it:8080/geoserver/apar_wms/wms", { LAYERS: 'apar_wms:toscana_ctr_10k', STYLES: '', format: 'image/png', transparent: 'true' }, { ratio: 1, displayOutsideMaxExtent: true, isBaseLayer: false, 'visibility': true, projection: new OpenLayers.Projection("EPSG:900913") } ); map.addLayer(toscana_ctr_wms); toscana_ctr_wms.setVisibility(false); // WMS Umbria var umbria_ctr_wms = new OpenLayers.Layer.WMS( "apar_wms:0", "http://sitap.beniculturali.it:8080/geoserver/apar_wms/wms", { LAYERS: 'apar_wms:0', STYLES: '', format: 'image/png', transparent: 'true' }, { ratio: 1, displayOutsideMaxExtent: true, isBaseLayer: false, 'visibility': true, projection: new OpenLayers.Projection("EPSG:900913") } ); map.addLayer(umbria_ctr_wms); umbria_ctr_wms.setVisibility(false); /* *** GESTIONE DEL MENU *** */ //WMS Abruzzo $('#abruzzo_ctr_wms').click(function() { abruzzo_ctr_wms.setVisibility(this.checked); }); $('#abruzzo_ctr_wms').attr('checked', false) //WMS Emilia Romagna $('#emiliaromagna_ctr_wms').click(function() { emiliaromagna_ctr_wms.setVisibility(this.checked); }); $('#emiliaromagna_ctr_wms').attr('checked', false) //WMS Lazio $('#lazio_ctr_wms').click(function() { lazio_ctr_wms.setVisibility(this.checked); }); $('#lazio_ctr_wms').attr('checked', false) //WMS Liguria $('#liguria_ctr_wms').click(function() { liguria_ctr_wms.setVisibility(this.checked); }); $('#liguria_ctr_wms').attr('checked', false) //WMS Lombradia $('#lombardia_ctr_wms').click(function() { lombardia_ctr_wms.setVisibility(this.checked); }); $('#lombardia_ctr_wms').attr('checked', false) //WMS Molise $('#molise_ctr_wms').click(function() { molise_ctr_wms.setVisibility(this.checked); }); $('#molise_ctr_wms').attr('checked', false) //WMS Piemonte $('#piemonte_ctr_wms').click(function() { piemonte_ctr_wms.setVisibility(this.checked); }); $('#piemonte_ctr_wms').attr('checked', false) //WMS Sicilia $('#sicilia_ctr_wms').click(function() { sicilia_ctr_wms.setVisibility(this.checked); }); $('#sicilia_ctr_wms').attr('checked', false) //WMS Toscana $('#toscana_ctr_wms').click(function() { toscana_ctr_wms.setVisibility(this.checked); }); $('#toscana_ctr_wms').attr('checked', false) //WMS Umbria $('#umbria_ctr_wms').click(function() { umbria_ctr_wms.setVisibility(this.checked); }); $('#umbria_ctr_wms').attr('checked', false) /* ************************************* FINE WMS REGIONALI ************************************* */ Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[08006] [7] could not connect to server: No route to host Is the server running on host "10.96.0.34" and accepting TCP/IP connections on port 5432?' in /var/www/html/sitap/wms.class.php:204 Stack trace: #0 /var/www/html/sitap/wms.class.php(204): PDO->__construct('pgsql:host=10.9...') #1 /var/www/html/sitap/wms_utente_map.php(48): Wms->count(Object(FiltriWms)) #2 /var/www/html/sitap/js/map.js.php(590): require_once('/var/www/html/s...') #3 {main} thrown in /var/www/html/sitap/wms.class.php on line 204