Skip to content

Commit 6e60422

Browse files
Merge pull request #133 from Falke-Design/feat/cleanup_tests
Clean up tests
2 parents 6e343c0 + f6a307d commit 6e60422

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+2161
-112
lines changed

test.js

Lines changed: 0 additions & 10 deletions
This file was deleted.

tests/arrayBuffer.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html>
33
<head>
44
<meta name="viewport" content="width=device-width, initial-scale=1" />
5-
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.0.3/dist/leaflet.css" />
5+
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
66
<style>
77
#map {
88
bottom: 0;
@@ -16,7 +16,7 @@
1616
<body>
1717
<div id="map"></div>
1818
<script src="https://unpkg.com/browse/whatwg-fetch@3.2.0/dist/fetch.umd.js"></script>
19-
<script src="https://unpkg.com/leaflet@1.0.3/dist/leaflet.js"></script>
19+
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
2020
<script src="https://unpkg.com/georaster"></script>
2121
<script src="../dist/georaster-layer-for-leaflet.min.js"></script>
2222
<script>
@@ -28,7 +28,8 @@
2828
attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
2929
}).addTo(map);
3030

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

3334
fetch(url_to_geotiff_file)
3435
.then(function (response) {

tests/arrayBufferInUTM.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html>
33
<head>
44
<meta name="viewport" content="width=device-width, initial-scale=1" />
5-
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.0.3/dist/leaflet.css" />
5+
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
66
<style>
77
#map {
88
bottom: 0;
@@ -16,7 +16,7 @@
1616
<body>
1717
<div id="map"></div>
1818
<script src="https://unpkg.com/browse/whatwg-fetch@3.2.0/dist/fetch.umd.js"></script>
19-
<script src="https://unpkg.com/leaflet@1.0.3/dist/leaflet.js"></script>
19+
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
2020
<script src="https://unpkg.com/proj4"></script>
2121
<script src="https://unpkg.com/georaster"></script>
2222
<script src="../dist/georaster-layer-for-leaflet.min.js"></script>

tests/arrows.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html>
33
<head>
44
<meta name="viewport" content="width=device-width, initial-scale=1" />
5-
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.0.3/dist/leaflet.css" />
5+
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
66
<style>
77
#map {
88
bottom: 0;
@@ -16,7 +16,7 @@
1616
<body>
1717
<div id="map"></div>
1818
<script src="https://unpkg.com/browse/whatwg-fetch@3.2.0/dist/fetch.umd.js"></script>
19-
<script src="https://unpkg.com/leaflet@1.0.3/dist/leaflet.js"></script>
19+
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
2020
<script src="https://unpkg.com/georaster"></script>
2121
<script src="../dist/georaster-layer-for-leaflet.min.js"></script>
2222
<script>

tests/cog-error-fallback.html

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html>
33
<head>
44
<meta name="viewport" content="width=device-width, initial-scale=1" />
5-
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.0.3/dist/leaflet.css" />
5+
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
66
<style>
77
#map {
88
bottom: 0;
@@ -16,7 +16,7 @@
1616
<body>
1717
<div id="map"></div>
1818
<script src="https://unpkg.com/browse/whatwg-fetch@3.2.0/dist/fetch.umd.js"></script>
19-
<script src="https://unpkg.com/leaflet@1.0.3/dist/leaflet.js"></script>
19+
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
2020
<script src="https://unpkg.com/georaster"></script>
2121
<script src="https://unpkg.com/proj4"></script>
2222
<script src="../dist/georaster-layer-for-leaflet.min.js"></script>
@@ -30,10 +30,11 @@
3030
}).addTo(map);
3131

3232
const rasterUrl =
33-
"https://storage.googleapis.com/pdd-stac/disasters/hurricane-harvey/0831/20170831_172754_101c_3b_Visual.tif";
33+
"https://storage.googleapis.com/pdd-stac/disasters/hurricane-harvey/0831/20170831_172754_101c_3b_Visual.tif";
3434
parseGeoraster(rasterUrl).then(function (georaster) {
35-
36-
georaster.getValues = () => { throw new Error("failure to fetch values"); }
35+
georaster.getValues = () => {
36+
throw new Error("failure to fetch values");
37+
};
3738

3839
const { noDataValue } = georaster;
3940
const resolution = 64;
@@ -45,7 +46,7 @@
4546

4647
setTimeout(() => {
4748
map.flyToBounds(lyr.getBounds());
48-
}, 1000)
49+
}, 1000);
4950

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

6263
const { x, y, z } = coords;
6364
const img = new Image(256, 256);
64-
img.onload = () => data.tile.getContext('2d').drawImage(img, 0, 0);
65+
img.onload = () => data.tile.getContext("2d").drawImage(img, 0, 0);
6566
img.src = `https://tiles.rdnt.io/tiles/${z}/${x}/${y}?url=${rasterUrl}`;
6667
});
6768
});

tests/cog-mask.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html>
33
<head>
44
<meta name="viewport" content="width=device-width, initial-scale=1" />
5-
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.0.3/dist/leaflet.css" />
5+
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
66
<script src="https://unpkg.com/reproject-geojson"></script>
77
<style>
88
#map {
@@ -17,7 +17,7 @@
1717
<body>
1818
<div id="map"></div>
1919
<script src="https://unpkg.com/browse/whatwg-fetch@3.2.0/dist/fetch.umd.js"></script>
20-
<script src="https://unpkg.com/leaflet@1.0.3/dist/leaflet.js"></script>
20+
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
2121
<script src="https://unpkg.com/georaster"></script>
2222
<script src="https://unpkg.com/proj4"></script>
2323
<script src="../dist/georaster-layer-for-leaflet.min.js"></script>
@@ -74,7 +74,7 @@
7474

7575
setTimeout(() => {
7676
map.flyToBounds(layer.getBounds());
77-
}, 1000)
77+
}, 1000);
7878
});
7979
</script>
8080
</body>

tests/cog-single-band-canopy.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html>
33
<head>
44
<meta name="viewport" content="width=device-width, initial-scale=1" />
5-
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.0.3/dist/leaflet.css" />
5+
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
66
<style>
77
#map {
88
bottom: 0;
@@ -16,7 +16,7 @@
1616
<body>
1717
<div id="map"></div>
1818
<script src="https://unpkg.com/browse/whatwg-fetch@3.2.0/dist/fetch.umd.js"></script>
19-
<script src="https://unpkg.com/leaflet@1.0.3/dist/leaflet.js"></script>
19+
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
2020
<script src="https://unpkg.com/georaster"></script>
2121
<script src="../dist/georaster-layer-for-leaflet.min.js"></script>
2222
<script>
@@ -28,7 +28,8 @@
2828
attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
2929
}).addTo(map);
3030

31-
const url_to_geotiff_file = "https://georaster-layer-for-leaflet.s3.amazonaws.com/California-Vegetation-CanopyBaseHeight-2016-Summer-00010m.tiff";
31+
const url_to_geotiff_file =
32+
"https://georaster-layer-for-leaflet.s3.amazonaws.com/California-Vegetation-CanopyBaseHeight-2016-Summer-00010m.tiff";
3233
parseGeoraster(url_to_geotiff_file).then(function (georaster) {
3334
console.log("georaster:", georaster);
3435
const layer = new GeoRasterLayer({

tests/cog.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html>
33
<head>
44
<meta name="viewport" content="width=device-width, initial-scale=1" />
5-
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.0.3/dist/leaflet.css" />
5+
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
66
<style>
77
#map {
88
bottom: 0;
@@ -16,7 +16,7 @@
1616
<body>
1717
<div id="map"></div>
1818
<script src="https://unpkg.com/browse/whatwg-fetch@3.2.0/dist/fetch.umd.js"></script>
19-
<script src="https://unpkg.com/leaflet@1.0.3/dist/leaflet.js"></script>
19+
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
2020
<script src="https://unpkg.com/georaster"></script>
2121
<script src="https://unpkg.com/proj4"></script>
2222
<script src="../dist/georaster-layer-for-leaflet.min.js"></script>
@@ -57,7 +57,7 @@
5757

5858
setTimeout(() => {
5959
map.flyToBounds(layer.getBounds());
60-
}, 1000)
60+
}, 1000);
6161
});
6262
</script>
6363
</body>

tests/color-scale.2.html

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<!DOCTYPE html>
22
<html>
33
<head>
4-
<meta name="viewport" content="width=device-width, initial-scale=1">
5-
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.0.3/dist/leaflet.css"/>
4+
<meta name="viewport" content="width=device-width, initial-scale=1" />
5+
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
66
<style>
77
#map {
88
bottom: 0;
@@ -15,18 +15,18 @@
1515
</head>
1616
<body>
1717
<div id="map"></div>
18-
<script src="https://unpkg.com/leaflet@1.0.3/dist/leaflet.js"></script>
18+
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
1919
<script src="https://unpkg.com/georaster"></script>
2020
<script src="https://unpkg.com/chroma-js"></script>
2121
<script src="https://unpkg.com/georaster-layer-for-leaflet@2"></script>
2222

2323
<script>
2424
// initalize leaflet map
25-
var map = L.map('map').setView([0, 0], 5);
25+
var map = L.map("map").setView([0, 0], 5);
2626

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

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

4747
var layer = new GeoRasterLayer({
48-
debugLevel: 4,
49-
georaster: georaster,
50-
opacity: 0.7,
51-
pixelValuesToColorFn: function(pixelValues) {
52-
var pixelValue = pixelValues[0]; // there's just one band in this raster
48+
debugLevel: 4,
49+
georaster: georaster,
50+
opacity: 0.7,
51+
pixelValuesToColorFn: function (pixelValues) {
52+
var pixelValue = pixelValues[0]; // there's just one band in this raster
5353

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

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

60-
var color = scale(scaledPixelValue).hex();
60+
var color = scale(scaledPixelValue).hex();
6161

62-
return color;
63-
},
64-
resolution: 256
62+
return color;
63+
},
64+
resolution: 256
6565
});
6666
console.log("layer:", layer);
6767
layer.addTo(map);
@@ -71,4 +71,4 @@
7171
});
7272
</script>
7373
</body>
74-
</html>
74+
</html>

tests/color-scale.html

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<!DOCTYPE html>
22
<html>
33
<head>
4-
<meta name="viewport" content="width=device-width, initial-scale=1">
5-
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.0.3/dist/leaflet.css"/>
4+
<meta name="viewport" content="width=device-width, initial-scale=1" />
5+
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
66
<style>
77
#map {
88
bottom: 0;
@@ -15,18 +15,18 @@
1515
</head>
1616
<body>
1717
<div id="map"></div>
18-
<script src="https://unpkg.com/leaflet@1.0.3/dist/leaflet.js"></script>
18+
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
1919
<script src="https://unpkg.com/georaster"></script>
2020
<script src="https://unpkg.com/chroma-js"></script>
2121
<script src="../dist/georaster-layer-for-leaflet.min.js"></script>
2222

2323
<script>
2424
// initalize leaflet map
25-
var map = L.map('map').setView([0, 0], 0);
25+
var map = L.map("map").setView([0, 0], 0);
2626

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

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

4747
var layer = new GeoRasterLayer({
48-
debugLevel: 4,
49-
georaster,
50-
opacity: 0.7,
51-
pixelValuesToColorFn: function(pixelValues) {
52-
var pixelValue = pixelValues[0]; // there's just one band in this raster
48+
debugLevel: 4,
49+
georaster,
50+
opacity: 0.7,
51+
pixelValuesToColorFn: function (pixelValues) {
52+
var pixelValue = pixelValues[0]; // there's just one band in this raster
5353

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

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

60-
var color = scale(scaledPixelValue).hex();
60+
var color = scale(scaledPixelValue).hex();
6161

62-
return color;
63-
},
64-
resolution: 256
62+
return color;
63+
},
64+
resolution: 256
6565
});
6666
console.log("layer:", layer);
6767
layer.addTo(map);
@@ -71,4 +71,4 @@
7171
});
7272
</script>
7373
</body>
74-
</html>
74+
</html>

0 commit comments

Comments
 (0)