update embedding instructions

This commit is contained in:
vcoppe
2026-03-28 12:09:31 +01:00
parent f70f92a176
commit 9743fd460e
5 changed files with 15 additions and 6 deletions

View File

@@ -90,6 +90,9 @@ export function getCleanedEmbeddingOptions(
delete cleanedOptions[key]; delete cleanedOptions[key];
} }
} }
if (cleanedOptions['key'] && cleanedOptions['key'] === PUBLIC_MAPTILER_KEY) {
delete cleanedOptions['key'];
}
return cleanedOptions; return cleanedOptions;
} }

View File

@@ -85,9 +85,11 @@ export class StyleManager {
this.merge(style, basemapStyle); this.merge(style, basemapStyle);
const terrain = this.getCurrentTerrain(); if (this._maptilerKey !== '') {
style.sources[terrain.source] = terrainSources[terrain.source]; const terrain = this.getCurrentTerrain();
style.terrain = terrain.exaggeration > 0 ? terrain : undefined; style.sources[terrain.source] = terrainSources[terrain.source];
style.terrain = terrain.exaggeration > 0 ? terrain : undefined;
}
style.layers.push(...anchorLayers); style.layers.push(...anchorLayers);
@@ -152,6 +154,7 @@ export class StyleManager {
} }
updateTerrain() { updateTerrain() {
if (this._maptilerKey === '') return;
const map_ = get(this._map); const map_ = get(this._map);
if (!map_) return; if (!map_) return;

View File

@@ -12,8 +12,8 @@ title: Integration
You can use **gpx.studio** to create maps showing your GPX files and embed them in your website. You can use **gpx.studio** to create maps showing your GPX files and embed them in your website.
All you need is: All you need is:
1. A <a href="https://cloud.maptiler.com/auth/widget?next=https://cloud.maptiler.com/maps/" target="_blank">MapTiler key</a> to load the map, and 1. GPX files hosted on your server or on Google Drive, or accessible via a public URL;
1. GPX files hosted on your server or on Google Drive, or accessible via a public URL. 1. *Optional:* a <a href="https://cloud.maptiler.com/auth/widget?next=https://cloud.maptiler.com/maps/" target="_blank">MapTiler key</a> to load MapTiler maps.
You can then play with the configurator below to customize your map and generate the corresponding HTML code. You can then play with the configurator below to customize your map and generate the corresponding HTML code.

View File

@@ -528,7 +528,7 @@
}, },
"embedding": { "embedding": {
"title": "Create your own map", "title": "Create your own map",
"maptiler_key": "MapTiler key", "maptiler_key": "MapTiler key (optional, only required for MapTiler maps)",
"file_urls": "File URLs (separated by commas)", "file_urls": "File URLs (separated by commas)",
"drive_ids": "Google Drive file IDs (separated by commas)", "drive_ids": "Google Drive file IDs (separated by commas)",
"basemap": "Basemap", "basemap": "Basemap",

View File

@@ -19,6 +19,9 @@
return; return;
} }
embeddingOptions = getMergedEmbeddingOptions(options); embeddingOptions = getMergedEmbeddingOptions(options);
if (embeddingOptions.key === '' && embeddingOptions.basemap.startsWith('maptiler')) {
embeddingOptions.basemap = 'openStreetMap';
}
}); });
</script> </script>