Téléverser les fichiers vers "georaster"
This commit is contained in:
		
							parent
							
								
									05c9b18474
								
							
						
					
					
						commit
						7126d71bf5
					
				
					 2 changed files with 133 additions and 0 deletions
				
			
		
							
								
								
									
										60
									
								
								georaster/geotiff.github.io.htm
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										60
									
								
								georaster/geotiff.github.io.htm
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,60 @@ | |||
| <!DOCTYPE html> | ||||
| <html> | ||||
|   <head> | ||||
|     <meta name="viewport" content="width=device-width, initial-scale=1"> | ||||
|     <link rel="stylesheet" href="https://unpkg.com/leaflet@1.0.3/dist/leaflet.css"/> | ||||
|     <style> | ||||
|       #map { | ||||
|         bottom: 0; | ||||
|         left: 0; | ||||
|         position: absolute; | ||||
|         right: 0; | ||||
|         top: 0; | ||||
|       } | ||||
|     </style> | ||||
|   </head> | ||||
|   <body> | ||||
|     <div id="map"></div> | ||||
|     <script src="https://unpkg.com/leaflet@1.0.3/dist/leaflet.js"></script> | ||||
|     <script src="https://unpkg.com/georaster"></script> | ||||
|     <script src="https://unpkg.com/georaster-layer-for-leaflet"></script> | ||||
|     <script> | ||||
|       // initialize leaflet map | ||||
|       var map = L.map('map').setView([0, 0], 5); | ||||
| 
 | ||||
|       // add OpenStreetMap basemap | ||||
|       L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', { | ||||
|           attribution: '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors' | ||||
|       }).addTo(map); | ||||
| 
 | ||||
|       var url_to_geotiff_file = "http://86.252.142.56/KENNEDY.tif"; | ||||
| 
 | ||||
|       fetch(url_to_geotiff_file) | ||||
|         .then(response => response.arrayBuffer()) | ||||
|         .then(arrayBuffer => { | ||||
|           parseGeoraster(arrayBuffer).then(georaster => { | ||||
|             console.log("georaster:", georaster); | ||||
| 
 | ||||
|             /* | ||||
|                 GeoRasterLayer is an extension of GridLayer, | ||||
|                 which means can use GridLayer options like opacity. | ||||
| 
 | ||||
|                 Just make sure to include the georaster option! | ||||
| 
 | ||||
|                 http://leafletjs.com/reference-1.2.0.html#gridlayer | ||||
|             */ | ||||
|             var layer = new GeoRasterLayer({ | ||||
|                 georaster: georaster, | ||||
|                 opacity: 0.7, | ||||
|                 resolution: 256 | ||||
|             }); | ||||
|             layer.addTo(map); | ||||
| 
 | ||||
|             map.fitBounds(layer.getBounds()); | ||||
| 
 | ||||
|         }); | ||||
|       }); | ||||
| 
 | ||||
|     </script> | ||||
|   </body> | ||||
| </html> | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue