Supprimer load-file.html
This commit is contained in:
parent
4d96c2775b
commit
0ee96b99dd
1 changed files with 0 additions and 73 deletions
|
@ -1,73 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
||||||
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css"/>
|
|
||||||
<style>
|
|
||||||
#map {
|
|
||||||
height: 400px;
|
|
||||||
width: 600px;
|
|
||||||
max-width: 100%;
|
|
||||||
max-height: 100%;
|
|
||||||
background-color: white;
|
|
||||||
outline:auto;
|
|
||||||
}
|
|
||||||
#overlay {
|
|
||||||
height: 100px;
|
|
||||||
z-index: 9;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="overlay">
|
|
||||||
<h1>Load a GeoTIFF File</h1>
|
|
||||||
<input type="file" id="geotiff-file">
|
|
||||||
</div>
|
|
||||||
<div id="map"></div>
|
|
||||||
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"></script>
|
|
||||||
<script src="https://unpkg.com/georaster"></script>
|
|
||||||
<script src="https://unpkg.com/proj4"></script>
|
|
||||||
<script src="https://unpkg.com/georaster-layer-for-leaflet"></script>
|
|
||||||
<script>
|
|
||||||
// initalize 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);
|
|
||||||
|
|
||||||
document.getElementById("geotiff-file").addEventListener("change", function(event) {
|
|
||||||
var file = event.target.files[0];
|
|
||||||
console.log("file:", file);
|
|
||||||
|
|
||||||
var reader = new FileReader();
|
|
||||||
reader.readAsArrayBuffer(file);
|
|
||||||
reader.onloadend = function() {
|
|
||||||
var arrayBuffer = reader.result;
|
|
||||||
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
|
|
||||||
});
|
|
||||||
console.log("layer:", layer);
|
|
||||||
layer.addTo(map);
|
|
||||||
|
|
||||||
map.fitBounds(layer.getBounds());
|
|
||||||
});
|
|
||||||
};
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
Loading…
Reference in a new issue