Skip to content

Commit

Permalink
require full url for maptiler for now
Browse files Browse the repository at this point in the history
  • Loading branch information
petr-hajek committed Sep 16, 2024
1 parent c13b961 commit 47bdbb1
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion dist/bundle.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/bundle.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/config/local.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const stylePresets = [
// id: 'maptiler-streets',
// name: 'MapTiler Streets',
// type: 'maptiler-sdk',
// url: 'streets-v2',
// url: 'https://api.maptiler.com/maps/streets-v2/style.json',
// },
];

Expand Down
8 changes: 2 additions & 6 deletions src/fetch-url.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,8 @@ const fetchUrl = async url => {
let nextUrl = url;
if (urlIsMapbox) {
nextUrl = normalizeMapboxUrl(url, mapboxGlAccessToken);
} else if (
maptilerApiKey &&
(url.startsWith('https://api.maptiler.com') || !url.startsWith('http'))
) {
const maptilersdk = await import('@maptiler/sdk');
nextUrl = `${maptilersdk.expandMapStyle(url)}?key=${maptilerApiKey}`;
} else if (maptilerApiKey && url.startsWith('https://api.maptiler.com')) {
nextUrl = `${url}?key=${maptilerApiKey}`;
}
let response;
try {
Expand Down
2 changes: 1 addition & 1 deletion src/renderers.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const typeToRenderers = {
'vector-gl': glVectorRenderers,
'mapbox-gl': glVectorRenderers,
'maplibre-gl': glVectorRenderers,
'maptiler-sdk': [{ name: 'MapTiler SDK', value: 'maptiler-sdk' }],
'maptiler-sdk': glVectorRenderers,
};

export const getRenderers = (map, sources) => {
Expand Down

0 comments on commit 47bdbb1

Please sign in to comment.