Skip to content

Commit

Permalink
Merge pull request #68 from randyberos/asyncoption
Browse files Browse the repository at this point in the history
made tileLayer accept async buildTileUrlTemplate function
  • Loading branch information
DanielJDufour authored Oct 14, 2023
2 parents 2747c28 + c889242 commit 1b39f02
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/add.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export async function addTileLayer(asset, layerGroup, options) {
const key = asset.getKey();
const bounds = getBounds(asset, options);
if (options.buildTileUrlTemplate) {
const tileUrlTemplate = options.buildTileUrlTemplate({
const tileUrlTemplate = await options.buildTileUrlTemplate({
href,
url: href,
asset,
Expand Down
2 changes: 1 addition & 1 deletion test/tilers/titiler/build-tile-url-template.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
const url_to_stac_item = "https://www.planet.com/data/stac/disasters/hurricane-harvey/hurricane-harvey-0831/20170831_172754_101c/20170831_172754_101c.json";

fetch(url_to_stac_item).then(res => res.json()).then(async feature => {
const buildTileUrlTemplate = ({ asset, href, item }) => {
const buildTileUrlTemplate = async ({ asset, href, item }) => {
let bands = asset.findVisualBands();
if (!bands) {
return "https://tiles.rdnt.io/tiles/{z}/{x}/{y}@2x?url={url}";
Expand Down

0 comments on commit 1b39f02

Please sign in to comment.