Skip to content

Commit

Permalink
Merge pull request #133 from Falke-Design/feat/cleanup_tests
Browse files Browse the repository at this point in the history
Clean up tests
  • Loading branch information
DanielJDufour authored Jul 25, 2023
2 parents 6e343c0 + f6a307d commit 6e60422
Show file tree
Hide file tree
Showing 63 changed files with 2,161 additions and 112 deletions.
10 changes: 0 additions & 10 deletions test.js

This file was deleted.

7 changes: 4 additions & 3 deletions tests/arrayBuffer.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<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" />
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
<style>
#map {
bottom: 0;
Expand All @@ -16,7 +16,7 @@
<body>
<div id="map"></div>
<script src="https://unpkg.com/browse/[email protected]/dist/fetch.umd.js"></script>
<script src="https://unpkg.com/leaflet@1.0.3/dist/leaflet.js"></script>
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
<script src="https://unpkg.com/georaster"></script>
<script src="../dist/georaster-layer-for-leaflet.min.js"></script>
<script>
Expand All @@ -28,7 +28,8 @@
attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);

var url_to_geotiff_file = "https://raw.githubusercontent.com/GeoTIFF/georaster-layer-for-leaflet-example/master/example_4326.tif";
var url_to_geotiff_file =
"https://raw.githubusercontent.com/GeoTIFF/georaster-layer-for-leaflet-example/master/example_4326.tif";

fetch(url_to_geotiff_file)
.then(function (response) {
Expand Down
4 changes: 2 additions & 2 deletions tests/arrayBufferInUTM.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<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" />
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
<style>
#map {
bottom: 0;
Expand All @@ -16,7 +16,7 @@
<body>
<div id="map"></div>
<script src="https://unpkg.com/browse/[email protected]/dist/fetch.umd.js"></script>
<script src="https://unpkg.com/leaflet@1.0.3/dist/leaflet.js"></script>
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
<script src="https://unpkg.com/proj4"></script>
<script src="https://unpkg.com/georaster"></script>
<script src="../dist/georaster-layer-for-leaflet.min.js"></script>
Expand Down
4 changes: 2 additions & 2 deletions tests/arrows.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<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" />
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
<style>
#map {
bottom: 0;
Expand All @@ -16,7 +16,7 @@
<body>
<div id="map"></div>
<script src="https://unpkg.com/browse/[email protected]/dist/fetch.umd.js"></script>
<script src="https://unpkg.com/leaflet@1.0.3/dist/leaflet.js"></script>
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
<script src="https://unpkg.com/georaster"></script>
<script src="../dist/georaster-layer-for-leaflet.min.js"></script>
<script>
Expand Down
15 changes: 8 additions & 7 deletions tests/cog-error-fallback.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<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" />
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
<style>
#map {
bottom: 0;
Expand All @@ -16,7 +16,7 @@
<body>
<div id="map"></div>
<script src="https://unpkg.com/browse/[email protected]/dist/fetch.umd.js"></script>
<script src="https://unpkg.com/leaflet@1.0.3/dist/leaflet.js"></script>
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
<script src="https://unpkg.com/georaster"></script>
<script src="https://unpkg.com/proj4"></script>
<script src="../dist/georaster-layer-for-leaflet.min.js"></script>
Expand All @@ -30,10 +30,11 @@
}).addTo(map);

const rasterUrl =
"https://storage.googleapis.com/pdd-stac/disasters/hurricane-harvey/0831/20170831_172754_101c_3b_Visual.tif";
"https://storage.googleapis.com/pdd-stac/disasters/hurricane-harvey/0831/20170831_172754_101c_3b_Visual.tif";
parseGeoraster(rasterUrl).then(function (georaster) {

georaster.getValues = () => { throw new Error("failure to fetch values"); }
georaster.getValues = () => {
throw new Error("failure to fetch values");
};

const { noDataValue } = georaster;
const resolution = 64;
Expand All @@ -45,7 +46,7 @@

setTimeout(() => {
map.flyToBounds(lyr.getBounds());
}, 1000)
}, 1000);

lyr.on("tileerror", data => {
const { coords, tile } = data;
Expand All @@ -61,7 +62,7 @@

const { x, y, z } = coords;
const img = new Image(256, 256);
img.onload = () => data.tile.getContext('2d').drawImage(img, 0, 0);
img.onload = () => data.tile.getContext("2d").drawImage(img, 0, 0);
img.src = `https://tiles.rdnt.io/tiles/${z}/${x}/${y}?url=${rasterUrl}`;
});
});
Expand Down
6 changes: 3 additions & 3 deletions tests/cog-mask.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<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" />
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
<script src="https://unpkg.com/reproject-geojson"></script>
<style>
#map {
Expand All @@ -17,7 +17,7 @@
<body>
<div id="map"></div>
<script src="https://unpkg.com/browse/[email protected]/dist/fetch.umd.js"></script>
<script src="https://unpkg.com/leaflet@1.0.3/dist/leaflet.js"></script>
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
<script src="https://unpkg.com/georaster"></script>
<script src="https://unpkg.com/proj4"></script>
<script src="../dist/georaster-layer-for-leaflet.min.js"></script>
Expand Down Expand Up @@ -74,7 +74,7 @@

setTimeout(() => {
map.flyToBounds(layer.getBounds());
}, 1000)
}, 1000);
});
</script>
</body>
Expand Down
7 changes: 4 additions & 3 deletions tests/cog-single-band-canopy.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<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" />
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
<style>
#map {
bottom: 0;
Expand All @@ -16,7 +16,7 @@
<body>
<div id="map"></div>
<script src="https://unpkg.com/browse/[email protected]/dist/fetch.umd.js"></script>
<script src="https://unpkg.com/leaflet@1.0.3/dist/leaflet.js"></script>
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
<script src="https://unpkg.com/georaster"></script>
<script src="../dist/georaster-layer-for-leaflet.min.js"></script>
<script>
Expand All @@ -28,7 +28,8 @@
attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);

const url_to_geotiff_file = "https://georaster-layer-for-leaflet.s3.amazonaws.com/California-Vegetation-CanopyBaseHeight-2016-Summer-00010m.tiff";
const url_to_geotiff_file =
"https://georaster-layer-for-leaflet.s3.amazonaws.com/California-Vegetation-CanopyBaseHeight-2016-Summer-00010m.tiff";
parseGeoraster(url_to_geotiff_file).then(function (georaster) {
console.log("georaster:", georaster);
const layer = new GeoRasterLayer({
Expand Down
6 changes: 3 additions & 3 deletions tests/cog.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<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" />
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
<style>
#map {
bottom: 0;
Expand All @@ -16,7 +16,7 @@
<body>
<div id="map"></div>
<script src="https://unpkg.com/browse/[email protected]/dist/fetch.umd.js"></script>
<script src="https://unpkg.com/leaflet@1.0.3/dist/leaflet.js"></script>
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
<script src="https://unpkg.com/georaster"></script>
<script src="https://unpkg.com/proj4"></script>
<script src="../dist/georaster-layer-for-leaflet.min.js"></script>
Expand Down Expand Up @@ -57,7 +57,7 @@

setTimeout(() => {
map.flyToBounds(layer.getBounds());
}, 1000)
}, 1000);
});
</script>
</body>
Expand Down
40 changes: 20 additions & 20 deletions tests/color-scale.2.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<!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"/>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
<style>
#map {
bottom: 0;
Expand All @@ -15,18 +15,18 @@
</head>
<body>
<div id="map"></div>
<script src="https://unpkg.com/leaflet@1.0.3/dist/leaflet.js"></script>
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
<script src="https://unpkg.com/georaster"></script>
<script src="https://unpkg.com/chroma-js"></script>
<script src="https://unpkg.com/georaster-layer-for-leaflet@2"></script>

<script>
// initalize leaflet map
var map = L.map('map').setView([0, 0], 5);
var map = L.map("map").setView([0, 0], 5);

// add OpenStreetMap basemap
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
L.tileLayer("http://{s}.tile.osm.org/{z}/{x}/{y}.png", {
attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);

// originally from https://globalwindatlas.info/downloads/gis-files
Expand All @@ -45,23 +45,23 @@
var scale = chroma.scale("Viridis");

var layer = new GeoRasterLayer({
debugLevel: 4,
georaster: georaster,
opacity: 0.7,
pixelValuesToColorFn: function(pixelValues) {
var pixelValue = pixelValues[0]; // there's just one band in this raster
debugLevel: 4,
georaster: georaster,
opacity: 0.7,
pixelValuesToColorFn: function (pixelValues) {
var pixelValue = pixelValues[0]; // there's just one band in this raster

// if there's zero wind, don't return a color
if (pixelValue === 0) return null;
// if there's zero wind, don't return a color
if (pixelValue === 0) return null;

// scale to 0 - 1 used by chroma
var scaledPixelValue = (pixelValue - min) / range;
// scale to 0 - 1 used by chroma
var scaledPixelValue = (pixelValue - min) / range;

var color = scale(scaledPixelValue).hex();
var color = scale(scaledPixelValue).hex();

return color;
},
resolution: 256
return color;
},
resolution: 256
});
console.log("layer:", layer);
layer.addTo(map);
Expand All @@ -71,4 +71,4 @@
});
</script>
</body>
</html>
</html>
40 changes: 20 additions & 20 deletions tests/color-scale.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<!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"/>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
<style>
#map {
bottom: 0;
Expand All @@ -15,18 +15,18 @@
</head>
<body>
<div id="map"></div>
<script src="https://unpkg.com/leaflet@1.0.3/dist/leaflet.js"></script>
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
<script src="https://unpkg.com/georaster"></script>
<script src="https://unpkg.com/chroma-js"></script>
<script src="../dist/georaster-layer-for-leaflet.min.js"></script>

<script>
// initalize leaflet map
var map = L.map('map').setView([0, 0], 0);
var map = L.map("map").setView([0, 0], 0);

// add OpenStreetMap basemap
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
L.tileLayer("http://{s}.tile.osm.org/{z}/{x}/{y}.png", {
attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);

// originally from https://globalwindatlas.info/downloads/gis-files
Expand All @@ -45,23 +45,23 @@
var scale = chroma.scale("Viridis");

var layer = new GeoRasterLayer({
debugLevel: 4,
georaster,
opacity: 0.7,
pixelValuesToColorFn: function(pixelValues) {
var pixelValue = pixelValues[0]; // there's just one band in this raster
debugLevel: 4,
georaster,
opacity: 0.7,
pixelValuesToColorFn: function (pixelValues) {
var pixelValue = pixelValues[0]; // there's just one band in this raster

// if there's zero wind, don't return a color
if (pixelValue === 0) return null;
// if there's zero wind, don't return a color
if (pixelValue === 0) return null;

// scale to 0 - 1 used by chroma
var scaledPixelValue = (pixelValue - min) / range;
// scale to 0 - 1 used by chroma
var scaledPixelValue = (pixelValue - min) / range;

var color = scale(scaledPixelValue).hex();
var color = scale(scaledPixelValue).hex();

return color;
},
resolution: 256
return color;
},
resolution: 256
});
console.log("layer:", layer);
layer.addTo(map);
Expand All @@ -71,4 +71,4 @@
});
</script>
</body>
</html>
</html>
4 changes: 2 additions & 2 deletions tests/dynamic_threshold_ndvi.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<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" />
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
<style>
#map {
bottom: 0;
Expand Down Expand Up @@ -31,7 +31,7 @@
</div>
<script src="https://unpkg.com/browse/[email protected]/dist/fetch.umd.js"></script>
<script src="https://unpkg.com/chroma-js"></script>
<script src="https://unpkg.com/leaflet@1.0.3/dist/leaflet.js"></script>
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
<script src="https://unpkg.com/georaster"></script>
<script src="https://unpkg.com/proj4"></script>
<script src="../dist/georaster-layer-for-leaflet.min.js"></script>
Expand Down
Loading

0 comments on commit 6e60422

Please sign in to comment.