Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

made tileLayer accept async buildTileUrlTemplate function #68

Merged
merged 2 commits into from
Oct 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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