Skip to content

Commit

Permalink
custom tiler
Browse files Browse the repository at this point in the history
  • Loading branch information
scottyhq committed Feb 20, 2024
1 parent a46c5e2 commit 83ec06d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,14 @@ jobs:
if: steps.cache.outputs.cache-hit != 'true'
run: npm run build -- --historyMode=hash

- name: Show Config.js Runtime
continue-on-error: true
run: |
diff config.js dist/config.js
- name: Overwrite Config.js
run: |
cat dist/config.js
cp config.js dist/config.js
cat dist/config.js
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
Expand Down
29 changes: 13 additions & 16 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,19 @@ module.exports = {
apiCatalogPriority: null,
useTileLayerAsFallback: false,
displayGeoTiffByDefault: false,
buildTileUrlTemplate: ({
href, // the url to the GeoTIFF
asset, // the STAC Asset object
key, // the key or name in the assets object that points to the particular asset
item, // the STAC item / feature
bounds, // LatLngBounds of the STAC asset
isCOG = true, // true if the asset is definitely a cloud-optimized GeoTIFF
isVisual = true, // true when the asset's key is "visual" (case-insensitive)
}) => {
// assets has three bands of RGB, so no need to specify bands
if (isVisual) return "https://tiles.rdnt.io/tiles/{z}/{x}/{y}@2x?url={url}";

// select first three bands for non-visual assets, such as NAIP 4-band imagery
// where we might want to ignore the Near-Infrared Band
else return "https://tiles.rdnt.io/tiles/{z}/{x}/{y}@2x?url={url}&bands=1,2,3"
},
buildTileUrlTemplate: ({href, asset}) => {
let url = encodeURIComponent(asset.href.startsWith("/vsi") ? asset.href : href);
// console.log(url)
console.log(asset)
if (asset.href.endsWith('wrapped_phase.tif')) {
console.log('TITILER WRAPPED PHASE')
return "https://o2dj1bd0a4.execute-api.us-west-2.amazonaws.com/tiles/{z}/{x}/{y}@2x?url={url}&rescale=-3.14,3.14&colormap_name=hsv";
}
else {
console.log('TITLER DEFAULT')
return "https://o2dj1bd0a4.execute-api.us-west-2.amazonaws.com/tiles/{z}/{x}/{y}@2x?url={url}";
}
},
stacProxyUrl: null,
pathPrefix: "/",
historyMode: "history",
Expand Down

0 comments on commit 83ec06d

Please sign in to comment.