Skip to content

Commit

Permalink
Merge pull request #45 from stac-utils/remove-snowpack
Browse files Browse the repository at this point in the history
removed snowpack
  • Loading branch information
m-mohr authored Aug 16, 2022
2 parents 950affc + 6f40be7 commit 9599f61
Show file tree
Hide file tree
Showing 53 changed files with 266 additions and 71 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@
],
"scripts": {
"build": "webpack",
"dev": "concurrently \"npx snowpack build --polyfill-node --watch\" \"cd build && npx http-server\"",
"dev": "concurrently \"WEBPACK_WATCH=true webpack\" \"npm run serve\"",
"format": "npx prettier --arrow-parens=avoid --print-width=120 --trailing-comma=none --write src/*.js src/*/*.js",
"serve": "http-server --cors",
"serve": "npx srvd --debug",
"test": "echo 'no automatic tests'",
"tiler": "docker run --name titiler -p 8000:8000 --env PORT=8000 --rm -t developmentseed/titiler"
"tiler": "docker run --env-file=./.env --name titiler -p 8000:8000 --env PORT=8000 --rm -t developmentseed/titiler"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -80,9 +80,9 @@
"@babel/preset-env": "^7.18.2",
"babel-loader": "^8.2.2",
"concurrently": "^7.3.0",
"envisage": "^0.1.0",
"eslint-config-prettier": "^8.3.0",
"http-server": "^14.1.0",
"snowpack": "^3.7.1",
"webpack": "^5.42.0",
"webpack-cli": "^4.9.2"
},
Expand Down
17 changes: 0 additions & 17 deletions snowpack.config.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<body>
<div id="map"></div>
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"></script>
<script src="/index.js" type="module"></script>
<script src="/dist/stac-layer.min.js" type="module"></script>
<script type="module">
// initalize leaflet map
const map = L.map('map').setView([0, 0], 5);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<body>
<div id="map"></div>
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"></script>
<script src="/index.js" type="module"></script>
<script src="/dist/stac-layer.min.js" type="module"></script>
<script type="module">
// initalize leaflet map
const map = L.map('map').setView([0, 0], 5);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<body>
<div id="map"></div>
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"></script>
<script src="/index.js" type="module"></script>
<script src="/dist/stac-layer.min.js" type="module"></script>
<script type="module">
// initalize leaflet map
const map = L.map('map').setView([0, 0], 5);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<body>
<div id="map"></div>
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"></script>
<script src="/index.js" type="module"></script>
<script src="/dist/stac-layer.min.js" type="module"></script>
<script type="module">
// initalize leaflet map
const map = L.map('map').setView([0, 0], 5);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<body>
<div id="map"></div>
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"></script>
<script src="/index.js" type="module"></script>
<script src="/dist/stac-layer.min.js" type="module"></script>
<script type="module">
// initalize leaflet map
const map = L.map('map').setView([0, 0], 5);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<body>
<div id="map"></div>
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"></script>
<script src="/index.js" type="module"></script>
<script src="/dist/stac-layer.min.js" type="module"></script>
<script type="module">
// initalize leaflet map
const map = L.map('map').setView([0, 0], 5);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<body>
<div id="map"></div>
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"></script>
<script src="/index.js" type="module"></script>
<script src="/dist/stac-layer.min.js" type="module"></script>
<script type="module">
// initalize leaflet map
const map = L.map('map').setView([0, 0], 5);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<body>
<div id="map"></div>
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"></script>
<script src="/index.js" type="module"></script>
<script src="/dist/stac-layer.min.js" type="module"></script>
<script type="module">
// initalize leaflet map
const map = L.map('map').setView([0, 0], 5);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<body>
<div id="map"></div>
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"></script>
<script src="/index.js" type="module"></script>
<script src="/dist/stac-layer.min.js" type="module"></script>
<script type="module">
// initalize leaflet map
const map = L.map('map').setView([0, 0], 5);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<body>
<div id="map"></div>
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"></script>
<script src="/index.js" type="module"></script>
<script src="/dist/stac-layer.min.js" type="module"></script>
<script type="module">
// initalize leaflet map
const map = L.map('map').setView([0, 0], 5);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<body>
<div id="map"></div>
<script src="https://unpkg.com/leaflet/dist/leaflet.js"></script>
<script src="/index.js" type="module"></script>
<script src="/dist/stac-layer.min.js" type="module"></script>
<script type="module">
// initalize leaflet map
const map = L.map('map').setView([0, 0], 5);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<body>
<div id="map"></div>
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"></script>
<script src="/index.js" type="module"></script>
<script src="/dist/stac-layer.min.js" type="module"></script>
<script type="module">
// initalize leaflet map
const map = L.map('map').setView([0, 0], 5);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<body>
<div id="map"></div>
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"></script>
<script src="/index.js" type="module"></script>
<script src="/dist/stac-layer.min.js" type="module"></script>
<script type="module">
// initalize leaflet map
const map = L.map('map').setView([0, 0], 5);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<body>
<div id="map"></div>
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"></script>
<script src="/index.js" type="module"></script>
<script src="/dist/stac-layer.min.js" type="module"></script>
<script type="module">
// initalize leaflet map
const map = L.map('map').setView([0, 0], 5);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<body>
<div id="map"></div>
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"></script>
<script src="/index.js" type="module"></script>
<script src="/dist/stac-layer.min.js" type="module"></script>
<script type="module">
// initalize leaflet map
const map = L.map('map').setView([0, 0], 5);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<body>
<div id="map"></div>
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"></script>
<script src="/index.js" type="module"></script>
<script src="/dist/stac-layer.min.js" type="module"></script>
<script type="module">
// initalize leaflet map
const map = L.map('map').setView([0, 0], 5);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<body>
<div id="map"></div>
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"></script>
<script src="/index.js" type="module"></script>
<script src="/dist/stac-layer.min.js" type="module"></script>
<script type="module">
// initalize leaflet map
const map = L.map('map').setView([0, 0], 5);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<body>
<div id="map"></div>
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"></script>
<script src="/index.js" type="module"></script>
<script src="/dist/stac-layer.min.js" type="module"></script>
<script type="module">
// initalize leaflet map
const map = L.map('map').setView([0, 0], 5);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<body>
<div id="map"></div>
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"></script>
<script src="/index.js" type="module"></script>
<script src="/dist/stac-layer.min.js" type="module"></script>
<script type="module">
// initalize leaflet map
const map = L.map('map').setView([0, 0], 5);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<body>
<div id="map"></div>
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"></script>
<script src="/index.js" type="module"></script>
<script src="/dist/stac-layer.min.js" type="module"></script>
<script type="module">
// initalize leaflet map
const map = L.map('map').setView([0, 0], 5);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<div id="map"></div>
<script src="https://unpkg.com/flug"></script>
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"></script>
<script src="/index.js" type="module"></script>
<script src="/dist/stac-layer.min.js" type="module"></script>
<script type="module">
// initalize leaflet map
const map = L.map('map').setView([0, 0], 5);
Expand Down
48 changes: 48 additions & 0 deletions test/stac-item/cbers-2-cogs.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.8.0/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.8.0/dist/leaflet.js"></script>
<script src="/dist/stac-layer.min.js" type="module"></script>
<script type="module">
// initalize leaflet map
const 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'
}).addTo(map);

// https://cbers-stac-1-0-0.s3.amazonaws.com/CBERS4A/MUX/097/097/CBERS_4A_MUX_20220313_097_097_L4.json
// https://cbers-stac-1-0-0.s3.amazonaws.com/CBERS4A/WPM/209/139/CBERS_4A_WPM_20200730_209_139_L4.json
const url_to_stac_item = "https://cbers-stac-1-0-0.s3.amazonaws.com/CBERS4A/MUX/203/138/CBERS_4A_MUX_20210905_203_138_L4.json";

fetch(url_to_stac_item).then(res => res.json()).then(async feature => {
const lyr = await L.stacLayer(feature, {
debugLevel: 2,
tileUrlTemplate: `http://localhost:8000/stac/tiles/{z}/{x}/{y}@2x?url={url}&assets=B3,`,
timeout: 10,
assets: [
"B3", "B2", "B1"
]
});
lyr.on('click', console.log);
lyr.addTo(map);
map.fitBounds(lyr.getLayers()[0].getBounds());
});
</script>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<body>
<div id="map"></div>
<script src="https://unpkg.com/leaflet@1.0.3/dist/leaflet.js"></script>
<script src="/index.js" type="module"></script>
<script src="/dist/stac-layer.min.js" type="module"></script>
<script type="module">
// initalize leaflet map
const map = L.map('map').setView([0, 0], 5);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<body>
<div id="map"></div>
<script src="https://unpkg.com/leaflet@1.0.3/dist/leaflet.js"></script>
<script src="/index.js" type="module"></script>
<script src="/dist/stac-layer.min.js" type="module"></script>
<script type="module">
// initalize leaflet map
const map = L.map('map').setView([0, 0], 5);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<body>
<div id="map"></div>
<script src="https://unpkg.com/leaflet@1.0.3/dist/leaflet.js"></script>
<script src="/index.js" type="module"></script>
<script src="/dist/stac-layer.min.js" type="module"></script>
<script type="module">
// initalize leaflet map
const map = L.map('map').setView([0, 0], 5);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<body>
<div id="map"></div>
<script src="https://unpkg.com/leaflet@1.0.3/dist/leaflet.js"></script>
<script src="/index.js" type="module"></script>
<script src="/dist/stac-layer.min.js" type="module"></script>
<script type="module">
// initalize leaflet map
const map = L.map('map').setView([0, 0], 5);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<body>
<div id="map"></div>
<script src="https://unpkg.com/leaflet@1.0.3/dist/leaflet.js"></script>
<script src="/index.js" type="module"></script>
<script src="/dist/stac-layer.min.js" type="module"></script>
<script type="module">
// initalize leaflet map
const map = L.map('map').setView([0, 0], 5);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<body>
<div id="map"></div>
<script src="https://unpkg.com/leaflet@1.0.3/dist/leaflet.js"></script>
<script src="/index.js" type="module"></script>
<script src="/dist/stac-layer.min.js" type="module"></script>
<script type="module">
// initalize leaflet map
const map = L.map('map').setView([0, 0], 5);
Expand Down
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.7.1/dist/leaflet.css"/>
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.8.0/dist/leaflet.css"/>
<style>
#map {
bottom: 0;
Expand All @@ -15,8 +15,8 @@
</head>
<body>
<div id="map"></div>
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"></script>
<script src="/index.js" type="module"></script>
<script src="https://unpkg.com/leaflet@1.8.0/dist/leaflet.js"></script>
<script src="/dist/stac-layer.min.js" type="module"></script>
<script type="module">
// initalize leaflet map
const map = L.map('map').setView([0, 0], 5);
Expand All @@ -27,10 +27,21 @@
}).addTo(map);


const url_to_stac_item = "https://raw.githubusercontent.com/cholmes/pdd-stac/beta2/disasters/hurricane-harvey/hurricane-harvey-0831/20170831_172754_101c/20170831_172754_101c.json";
const url_to_stac_data = "https://explorer.sandbox.dea.ga.gov.au/stac/collections/s2a_ard_granule/items/104dea3d-33e0-465a-9894-85c144e42c84";

fetch(url_to_stac_data).then(res => res.json()).then(async feature => {

fetch(url_to_stac_item).then(res => res.json()).then(async feature => {
const lyr = await L.stacLayer(feature, { debugLevel: 2 });
Object.keys(feature.assets).forEach(key => {
feature.assets[key].href = `http://localhost:8080/data/${key}.tif`;
});

const lyr = await L.stacLayer(feature, {
debugLevel: 2,
timeout: 10,
assets: [
"nbart_red", "nbart_green", "nbart_blue"
]
});
lyr.on('click', console.log);
lyr.addTo(map);
map.fitBounds(lyr.getBounds());
Expand Down
Loading

0 comments on commit 9599f61

Please sign in to comment.