mirror of
				https://github.com/KevinMidboe/OverlappingGeoJSON_Panes_Template.git
				synced 2025-10-29 17:50:29 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			248 lines
		
	
	
		
			8.7 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			248 lines
		
	
	
		
			8.7 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
| <!DOCTYPE html>
 | |
| <html>
 | |
| <head>
 | |
| <meta charset="utf-8">
 | |
|     <meta http-equiv="X-UA-Compatible" content="IE=edge">
 | |
|     <meta name="viewport" content="width=device-width, initial-scale=1">
 | |
|     <meta name="description" content="">
 | |
|     <meta name="author" content="">
 | |
| 
 | |
| <title>Overlapping GeoJ Template</title>
 | |
| 
 | |
| <link rel="icon" 
 | |
|       type="image/png" 
 | |
|       href="../img/brand-fav.png">
 | |
| <meta name="viewport" content="initial-scale=1.0, initial-scale=1.0">
 | |
| <script src='https://unpkg.com/leaflet@1.0.1/dist/leaflet.js'></script>
 | |
| <link href='https://unpkg.com/leaflet@1.0.1/dist/leaflet.css' rel='stylesheet' />
 | |
| <style>
 | |
|   body { margin:0; padding:0; }
 | |
|   #map { 
 | |
|       height:920px; 
 | |
|       }
 | |
|   .custom-popup .leaflet-popup-content-wrapper {
 | |
|     text-align:center;
 | |
|   }
 | |
|   .custom-popup .leaflet-popup-content-wrapper a {
 | |
|   }
 | |
|   .btn-custom {
 | |
|   background-color: hsl(197, 46%, 41%) !important;
 | |
|   background-repeat: repeat-x;
 | |
|   filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#489abb", endColorstr="#387d98");
 | |
|   background-image: -khtml-gradient(linear, left top, left bottom, from(#489abb), to(#387d98));
 | |
|   background-image: -moz-linear-gradient(top, #489abb, #387d98);
 | |
|   background-image: -ms-linear-gradient(top, #489abb, #387d98);
 | |
|   background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #489abb), color-stop(100%, #387d98));
 | |
|   background-image: -webkit-linear-gradient(top, #489abb, #387d98);
 | |
|   background-image: -o-linear-gradient(top, #489abb, #387d98);
 | |
|   background-image: linear-gradient(#489abb, #387d98);
 | |
|   border-color: #387d98 #387d98 hsl(197, 46%, 38.5%);
 | |
|   color: #fff !important;
 | |
|   text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.16);
 | |
|   -webkit-font-smoothing: antialiased;
 | |
|   }
 | |
| 
 | |
|   .label-custom {
 | |
|   background-color: #939393;
 | |
| }
 | |
| 
 | |
|   }
 | |
|   .navbar-brand {
 | |
|   float: none;
 | |
|   }
 | |
| </style>
 | |
| <link rel="stylesheet" type="text/css" href="../tipuesearch/tipuesearch.css" >
 | |
| <link rel="stylesheet" type="text/css" href="../css/bootstrap.min.css">
 | |
| <link rel="stylesheet" type="text/css" href="../css/sticky-footer.css">
 | |
| <!-- Custom CSS -->
 | |
| <link href="../css/landing-page.css" rel="stylesheet">
 | |
| <!-- Custom Fonts -->
 | |
| <link href="../font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
 | |
| <link href="http://fonts.googleapis.com/css?family=Lato:300,400,700,300italic,400italic,700italic" rel="stylesheet" type="text/css">
 | |
| <script type="text/javascript" src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
 | |
| <script type="text/javascript" src="../js/bootstrap.min.js"></script>
 | |
| <script type="text/javascript">
 | |
|     $(document).ready(function(){
 | |
|         $('#myModal').modal('show');
 | |
|     });
 | |
| </script>
 | |
| <style>
 | |
| @media screen and (min-width: 768px) {
 | |
|   #myModal .modal-dialog  {width:350px;
 | |
|   }
 | |
| }
 | |
| </style>
 | |
| </head>
 | |
| 
 | |
| <body>
 | |
| 
 | |
| <div class="container">
 | |
|     <div class="row">
 | |
|         <div class="col-sm-12" style="padding:0px 0px 0px 0px">
 | |
|             <div id='map'class='custom-popup'></div> 
 | |
|         </div>
 | |
|     </div>
 | |
| </div>
 | |
| <!-- Bottom Text -->
 | |
| <div class="container">
 | |
|   <div class="row">
 | |
|         <div class="col-sm-12">
 | |
|         </div>
 | |
|   </div>
 | |
| 
 | |
| 
 | |
| 
 | |
| <script>
 | |
| 
 | |
|     var map = L.map('map') 
 | |
|  
 | |
| 
 | |
|  // creating panes: the name is pane250. the zindex is 250. 250 is furthest from the user. 252 is the closest to the user. pointer events is always none (not sure why)
 | |
| 
 | |
|     map.createPane('pane250');
 | |
|     map.getPane('pane250').style.zIndex = 250;
 | |
|     map.getPane('pane250').style.pointerEvents = 'none';
 | |
| 
 | |
|     map.createPane('pane251');
 | |
|     map.getPane('pane251').style.zIndex = 251;
 | |
|     map.getPane('pane251').style.pointerEvents = 'none';
 | |
| 
 | |
|     map.createPane('pane252');
 | |
|     map.getPane('pane252').style.zIndex = 252;
 | |
|     map.getPane('pane252').style.pointerEvents = 'none';
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
|         L.tileLayer('http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}', {
 | |
| 	attribution: 'Tiles © Esri — Esri, DeLorme, NAVTEQ, TomTom, Intermap, iPC, USGS, FAO, NPS, NRCAN, GeoBase, Kadaster NL, Ordnance Survey, Esri Japan, METI, Esri China (Hong Kong), and the GIS User Community'
 | |
|         }).addTo(map);
 | |
| 
 | |
| 
 | |
| map.setView({ lat: 43.39707, lng: -63.77014}, 5);
 | |
| 
 | |
|         var options = {
 | |
|             minZoom: 12,
 | |
|             maxZoom: 20,
 | |
|             opacity: 1.0,
 | |
|             tms: true,
 | |
|             zIndex: 2,};
 | |
| 
 | |
| 
 | |
|             // style for the large geojson - the one that should be furthest from the viewrer: 250
 | |
| 
 | |
| 
 | |
|          var stylelargegeoj = {
 | |
|          color:"#006666", opacity:".8", weight:".5",fillOpacity:".1"};
 | |
|          var stylelargegeojmo = {
 | |
|          color:"#006666", opacity:".8", weight:"5", fillOpacity:".15"};
 | |
| 
 | |
|           function onEachFeaturestylelargegeoj(feature, layer) {
 | |
|               {
 | |
|         layer.bindPopup("This is " + feature.properties.title + ", Volume " + feature.properties.volume + ", Part " + feature.properties.part + ", Plate " + feature.properties.number +
 | |
|         ' </br></br><a class="btn btn-custom btn-sm" href="' + layer.feature.properties.url + '" role="button" target="_blank">view original<\/a>');
 | |
|         layer.setStyle(stylelargegeoj);
 | |
|           (function (layer, properties){
 | |
|           layer.on("mouseover", function(e){
 | |
|             layer.setStyle(stylelargegeojmo);
 | |
|           });
 | |
|           layer.on("mouseout", function(e){
 | |
|             layer.setStyle(stylelargegeoj);
 | |
|           });
 | |
|         })(layer, feature.properties);
 | |
|         }
 | |
|         };
 | |
| 
 | |
| 
 | |
| 
 | |
|         // for the 251 geoj - inbetween
 | |
| 
 | |
| 		var stylemediumgeoj = {
 | |
|          color:"#0033cc", opacity:".8", weight:".75",fillOpacity:".2"};
 | |
|          var stylemediumgeojmo = {
 | |
|          color:"#0033cc", opacity:".8", weight:"5", fillOpacity:".25"};
 | |
| 
 | |
|           function onEachFeaturestylemediumgeoj(feature, layer) {
 | |
|               {
 | |
|         layer.bindPopup("This is " + feature.properties.title + ", Volume " + feature.properties.volume + ", Part " + feature.properties.part + ", Plate " + feature.properties.number +
 | |
|         ' </br></br><a class="btn btn-custom btn-sm" href="' + layer.feature.properties.url + '" role="button" target="_blank">view original<\/a>');
 | |
|         layer.setStyle(stylemediumgeoj);
 | |
|           (function (layer, properties){
 | |
|           layer.on("mouseover", function(e){
 | |
|             layer.setStyle(stylemediumgeojmo);
 | |
|           });
 | |
|           layer.on("mouseout", function(e){
 | |
|             layer.setStyle(stylemediumgeoj);
 | |
|           });
 | |
|         })(layer, feature.properties);
 | |
|         }
 | |
|         };
 | |
| 
 | |
|         // 252 - the closest geoj visible to user.
 | |
| 
 | |
|         var stylesmallgeoj = {
 | |
|          color:"#800000", opacity:".8", weight:".5",fillOpacity:".1"};
 | |
|         var stylesmallgeojmo = {
 | |
|          color:"#800000", opacity:".8", weight:"5", fillOpacity:".15"};
 | |
| 
 | |
|           function onEachFeaturestylesmallgeoj(feature, layer) {
 | |
|               {
 | |
|         layer.bindPopup("This is " + feature.properties.title + ", Volume " + feature.properties.volume + ", Part " + feature.properties.part + ", Plate " + feature.properties.number +
 | |
|         ' </br></br><a class="btn btn-custom btn-sm" href="' + layer.feature.properties.url + '" role="button" target="_blank">view original<\/a>');
 | |
|         layer.setStyle(stylesmallgeoj);
 | |
|           (function (layer, properties){
 | |
|           layer.on("mouseover", function(e){
 | |
|             layer.setStyle(stylesmallgeojmo);
 | |
|           });
 | |
|           layer.on("mouseout", function(e){
 | |
|             layer.setStyle(stylesmallgeoj);
 | |
|           });
 | |
|         })(layer, feature.properties);
 | |
|         }
 | |
|         };
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| // loading geojsons - see sizes in the name. First the variable is set. Then ajax loads from raw github. Then we set the variable defined by its name = to the geojson layer which pulls the oneachfeature. The pane is also identified by the pane's given name 'pane250' which refers to the previous section where pane250 was set = to zindex of 250.
 | |
| 
 | |
| var LARGEGEOJ;
 | |
| $.getJSON("https://raw.githubusercontent.com/ect123/Des-Barres-findingaid/master/maps/2-2a-27a.geojson",function(data){
 | |
|       LARGEGEOJ = L.geoJson(data, {onEachFeature: onEachFeaturestylelargegeoj, pane: 'pane250'}).addTo(map);
 | |
|       });
 | |
| 
 | |
| 
 | |
| var MEDIUMGEOJ;
 | |
| $.getJSON("https://raw.githubusercontent.com/ect123/Des-Barres-findingaid/master/maps/2-2a-31.geojson",function(data){
 | |
|       MEDIUMGEOJ = L.geoJson(data, {onEachFeature: onEachFeaturestylemediumgeoj, pane: 'pane251'}).addTo(map);
 | |
|       });
 | |
| 
 | |
| 
 | |
| var SMALLGEOJ;
 | |
| $.getJSON("https://raw.githubusercontent.com/ect123/Des-Barres-findingaid/master/maps/2-2a-34.geojson",function(data){
 | |
|       SMALLGEOJ = L.geoJson(data, {onEachFeature: onEachFeaturestylesmallgeoj, pane: 'pane252'}).addTo(map);
 | |
|       });
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| </script>
 | |
| 
 | |
| <script>
 | |
|   (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
 | |
|   (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
 | |
|   m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
 | |
|   })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
 | |
|   ga('create', 'UA-47313789-1', 'auto');
 | |
|   ga('send', 'pageview');
 | |
| </script>
 | |
| 
 | |
| </body>
 | |
| </html> |