Child pages
  • Success Stories - Map view

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

 

 

HTML
headtrue
width700
height700
    <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDwdVxyGviowqeOGo59Fu_TL2A_mcnvspw&sensor=SET_TO_TRUE_OR_FALSE"> </script>

    <script type="text/javascript">
		//Available marker in different colors
		var blue = new google.maps.MarkerImage('http://google.com/mapfiles/ms/micons/blue-dot.png');
        var green = new google.maps.MarkerImage('http://google.com/mapfiles/ms/micons/green-dot.png');
        var lightblue = new google.maps.MarkerImage('http://google.com/mapfiles/ms/micons/lightblue-dot.png');
        var orange = new google.maps.MarkerImage('http://google.com/mapfiles/ms/micons/orange-dot.png');
        var pink = new google.maps.MarkerImage('http://google.com/mapfiles/ms/micons/pink-dot.png');
        var purple = new google.maps.MarkerImage('http://google.com/mapfiles/ms/micons/purple-dot.png');        
        var red = new google.maps.MarkerImage('http://google.com/mapfiles/ms/micons/red-dot.png');         
        var activeIcon = new google.maps.MarkerImage('http://google.com/mapfiles/ms/micons/yellow-dot.png');



		/***********************************************************************************************/
    	/* START CUSTOM CONTENT                                                                        */
    	/***********************************************************************************************/
        
        //Map variables
        var start_center_lat = 4530;
        var start_center_lon = 10;
        var start_zoomlevel  = 2;
		var mapTypeId        = google.maps.MapTypeId.ROADMAP; //Values can be: ROADMAP, SATELLITE, HYBRID, TERRAIN 


		 //Content
        //Structure: [{title}, {latitude}, {longitude}, {z-index}, {link to wiki}, {markercolor}]
		//Values for markercolor: blue, green, lightblue, orange, pink, purple, red
		 var sites = [
            
			['Surface Deformation Monitoring', 32.5, 3.7, 1, 'https://earsc-portal.eu/plugins/viewsource/viewpagesrc.action?pageId=31229741', blue],
			['Soft Ground Mapping', 24.2, 51.7, 1, 'https://earsc-portal.eu/plugins/viewsource/viewpagesrc.action?pageId=31229779', blue],
			['Surface Geology Mapping', 28.7, 33.3, 1, 'https://earsc-portal.eu/plugins/viewsource/viewpagesrc.action?pageId=31229712', blue],
			['Ecosystem valuation and change', 60.3, -1.3, 1, 'https://earsc-portal.eu/plugins/viewsource/viewpagesrc.action?pageId=31229760', blue], 
			['Habitat impact assessment',  24.3, -89.4, 1, 'https://earsc-portal.eu/plugins/viewsource/viewpagesrc.action?pageId=31229779', green],
			['Oilfield performance study', 26.2, 50.1, 1, 'https://earsc-portal.eu/plugins/viewsource/viewpagesrc.action?pageId=31229749', pink],
            
            ['Pipeline Encroachment', 53.7, -113.2, 1, 'https://earsc-portal.eu/plugins/viewsource/viewpagesrc.action?pageId=31229805', pink],
['Hydrology', 57.02, -111.65, 1, 'https://earsc-portal.eu/plugins/viewsource/viewpagesrc.action?pageId=31229811', blue],
['Peru Flood Seismic Planning', -9.96, -73.19, 1, 'https://earsc-portal.eu/plugins/viewsource/viewpagesrc.action?pageId=31229818', purple],
['Kenya Flood Seismic Planning', 3.1, 35.2, 1, 'https://earsc-portal.eu/plugins/viewsource/viewpagesrc.action?pageId=31229824', purple],
['Current meter location study', -20, -39, 1, 'https://earsc-portal.eu/plugins/viewsource/viewpagesrc.action?pageId=31229845', green],
['Ocean Model Validation', -6.5, 127, 1, 'https://earsc-portal.eu/plugins/viewsource/viewpagesrc.action?pageId=3122900231229848', green],
['Current vein location', -35, 25, 1, 'https://earsc-portal.eu/plugins/viewsource/viewpagesrc.action?pageId=31229852', green],
['Congo River Plume Localization', -2.4, 16, 1, 'https://earsc-portal.eu/plugins/viewsource/viewpagesrc.action?pageId=3122901231229855', green],
['Ocean Model Circulation Operational Validation', 0, -45, 1, 'https://earsc-portal.eu/plugins/viewsource/viewpagesrc.action?pageId=3122901731229858', green],
['Bering Sea Project', 58, -178, 1, 'https://earsc-portal.eu/plugins/viewsource/viewpagesrc.action?pageId=3122902431229861', green],
['Determination of metrological and oceanographic conditions', 60, -55, 1, 'https://earsc-portal.eu/plugins/viewsource/viewpagesrc.action?pageId=3122902831229864', purplegreen],
['Oil spill disaster in Gulf Of Mexico', 24, -90, 1, 'https://earsc-portal.eu/plugins/viewsource/viewpagesrc.action?pageId=3122987131229868', green],
['Measuring surface wind', 34.5, 35, 1, 'https://earsc-portal.eu/plugins/viewsource/viewpagesrc.action?pageId=3122903731229838', green],


     ];



		/***********************************************************************************************/
    	/* END CUSTOM CONTENT                                                                           */    
    	/***********************************************************************************************/    

        
        
        //Global variables        
        var gmarkers = [];
        var infowindow = null;
		
		// Shapes define the clickable region of the icon.
        var shape = {
            coord: [9,0,6,1,4,2,2,4,0,8,0,12,1,14,2,16,5,19,7,23,8,26,9,30,9,34,11,34,11,30,12,26,13,24,14,21,16,18,18,16,20,12,20,8,18,4,16,2,15,1,13,0],
            type: 'poly'
        }; 		
		

		function initialize() {
			//Common parameters
			var myLatlng, marker;
			//Map parameters
			var mapOptions = {
          		center: new google.maps.LatLng(start_center_lat, start_center_lon),
          		zoom: start_zoomlevel,
          		scaleControl: true,
          		mapTypeId: mapTypeId        
       		 };

        	var map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);	
			setMarkers(map);
		 }

		function setMarkers(map) {
        	for (var i = 0; i < sites.length; i++) {
            	var siteLatLng = new google.maps.LatLng(sites[i][1], sites[i][2]);
            	var marker = new google.maps.Marker({
                	position: siteLatLng,
               	 	map:         map,
                	title:      sites[i][0],
                	zIndex:     sites[i][3],
                	link2wiki:  sites[i][4],
                	icon:       sites[i][5],
               		shape: shape
           	 	});
            
            	google.maps.event.addListener(marker, "click", function () {
                	for (var i=0; i < sites.length; i++) {
                   		gmarkers[i].setIcon(sites[i][5]);
                	}
                	this.setIcon(activeIcon);
                	markerClicked(this.link2wiki);
            	});
            
            google.maps.event.addListener(marker, "mouseover", function () {               
                for (var i=0; i < sites.length; i++) {
                   gmarkers[i].setIcon(sites[i][5]);
                }
                this.setIcon(activeIcon);
            });
            
            	google.maps.event.addListener(marker, "mouseout", function () {               
               		for (var i=0; i < sites.length; i++) {
                  		gmarkers[i].setIcon(sites[i][5]);
                	} 
					this.setIcon(activeIcon);               
           		});
            
            	gmarkers.push(marker);
        	}
    	}


  		function markerClicked( link2wiki ) {
			//GET HTML content with JS object
			document.getElementById("map_content").innerHTML  = '<object type="text/html" style="width:100%; height:100%;" data=" ' + link2wiki + '" ></object>';
			
			//GET HTML content with AJAX
			var xmlhttp;
			if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari
    			xmlhttp = new XMLHttpRequest();
			} else { // code for IE6, IE5
    			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			}
			xmlhttp.onreadystatechange = function() {
    			if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
        			document.getElementById("map_content").innerHTML = xmlhttp.responseText;
   				}
			}
			//Get Link content
			xmlhttp.open("GET", link2wiki, true);
			xmlhttp.send();


			//Open links in new tabs
			setTimeout(function () { 
    			var links =  document.getElementById("map_content").getElementsByTagName("a");
    			for (var i = 0; i < links.length; i++) {
        			links[i].target = "_blank";
    			} 			
			}, 500);
			
			//Set Header background-color to blue
			//Top Header
			document.getElementById("header").style.background = 'transparent';
			//Loaded Header
			var divs = document.getElementById("zen-main").getElementsByTagName('div');
			for(var i = 0; i< divs.length;i++)  {
    			divs[i].style.background = 'transparent';
			}
		}
	
	</script>
    
	<div id="container"> 
		<div id="headermap_canvas"  style="width:100%1000px; height:10%;400px" text-align:center;">
			<h1>EO4OG Case Studies</h1>
			<p>Click on a marker to get additional information from the Wiki</p>
		</div>
		<div id="map_canvas" style="width:800px; height:400px"="center"></div> <!-- Has to be defined in pixel to be shown in Confluence -->
		<div id="map_content" style="width:100%; height:600px; background:white;"></div>
	</div>

	<script type="text/javascript">
		initialize();
	</script>