-
-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feat/test_resolution
- Loading branch information
Showing
3 changed files
with
120 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<link rel="stylesheet" href="https://unpkg.com/leaflet/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/browse/[email protected]/dist/fetch.umd.js"></script> | ||
<script src="https://unpkg.com/leaflet/dist/leaflet-src.js"></script> | ||
<script src="https://unpkg.com/georaster"></script> | ||
<script src="../dist/georaster-layer-for-leaflet.min.js"></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); | ||
|
||
var url_to_geotiff_file = "https://geotiff.github.io/georaster-layer-for-leaflet-example/example_4326.tif"; | ||
|
||
fetch(url_to_geotiff_file) | ||
.then(function (response) { | ||
return response.arrayBuffer(); | ||
}) | ||
.then(function (arrayBuffer) { | ||
parseGeoraster(arrayBuffer).then(function (georaster) { | ||
console.log("georaster:", georaster); | ||
var layer = new GeoRasterLayer({ | ||
georaster: georaster, | ||
resolution: { | ||
0: 2, // Zoom level 0 or higher: resolution 2 | ||
16: 512 // Zoom level 16 or higher: resolution 512 | ||
}, | ||
caching: true | ||
}); | ||
layer.addTo(map); | ||
map.fitBounds(layer.getBounds()); | ||
}); | ||
}); | ||
</script> | ||
</body> | ||
</html> |