File tree Expand file tree Collapse file tree 5 files changed +29
-5
lines changed Expand file tree Collapse file tree 5 files changed +29
-5
lines changed Original file line number Diff line number Diff line change @@ -987,7 +987,9 @@ export default function MapContainerFactory(
987
987
mapboxAccessToken : currentStyle ?. accessToken || mapboxApiAccessToken ,
988
988
baseApiUrl : mapboxApiUrl ,
989
989
mapLib : getApplicationConfig ( ) . getMapLib ( ) ,
990
- transformRequest : this . props . transformRequest || transformRequest
990
+ transformRequest :
991
+ this . props . transformRequest ||
992
+ transformRequest ( currentStyle ?. accessToken || mapboxApiAccessToken )
991
993
} ;
992
994
993
995
const hasGeocoderLayer = Boolean ( layers . find ( l => l . id === GEOCODER_LAYER_ID ) ) ;
Original file line number Diff line number Diff line change @@ -162,7 +162,7 @@ function AddMapStyleModalFactory() {
162
162
mapboxAccessToken : mapboxApiAccessToken ,
163
163
mapLib : getApplicationConfig ( ) . getMapLib ( ) ,
164
164
preserveDrawingBuffer : true ,
165
- transformRequest
165
+ transformRequest : transformRequest ( mapboxApiAccessToken )
166
166
} ;
167
167
168
168
return (
Original file line number Diff line number Diff line change 58
58
"lodash.isequal" : " ^4.5.0" ,
59
59
"lodash.memoize" : " ^4.1.2" ,
60
60
"lodash.throttle" : " ^4.1.1" ,
61
+ "maplibregl-mapbox-request-transformer" : " ^0.0.2" ,
61
62
"mini-svg-data-uri" : " ^1.0.3" ,
62
63
"moment-timezone" : " ^0.5.35" ,
63
64
"react" : " ^18.2.0" ,
Original file line number Diff line number Diff line change 1
1
// SPDX-License-Identifier: MIT
2
2
// Copyright contributors to the kepler.gl project
3
3
4
+ import { isMapboxURL , transformMapboxUrl } from 'maplibregl-mapbox-request-transformer' ;
5
+
4
6
/**
5
7
* Determines whether a Map Style is using Mapbox Tiles
6
8
* @param {any } mapStyle the mapStyle to check
@@ -24,8 +26,19 @@ export function isStyleUsingMapboxTiles(mapStyle) {
24
26
} ) ;
25
27
}
26
28
27
- export const transformRequest = ( url : string ) : { url : string } => {
28
- return {
29
- url
29
+ /**
30
+ * Transform mapbox protocol so can be used with maplibre
31
+ * @param mapboxKey mapbox api key
32
+ * @returns transformed url
33
+ */
34
+ export const transformRequest = (
35
+ mapboxKey : string
36
+ ) : ( ( url : string , resourceType : string ) => { url : string } ) => {
37
+ return ( url : string , resourceType : string ) => {
38
+ if ( isMapboxURL ( url ) ) {
39
+ return transformMapboxUrl ( url , resourceType , mapboxKey ) ;
40
+ }
41
+
42
+ return { url} ;
30
43
} ;
31
44
} ;
Original file line number Diff line number Diff line change @@ -3623,6 +3623,7 @@ __metadata:
3623
3623
lodash.isequal: "npm:^4.5.0"
3624
3624
lodash.memoize: "npm:^4.1.2"
3625
3625
lodash.throttle: "npm:^4.1.1"
3626
+ maplibregl-mapbox-request-transformer: "npm:^0.0.2"
3626
3627
mini-svg-data-uri: "npm:^1.0.3"
3627
3628
moment-timezone: "npm:^0.5.35"
3628
3629
react: "npm:^18.2.0"
@@ -21443,6 +21444,13 @@ __metadata:
21443
21444
languageName: node
21444
21445
linkType: hard
21445
21446
21447
+ "maplibregl-mapbox-request-transformer@npm:^0.0.2":
21448
+ version: 0.0.2
21449
+ resolution: "maplibregl-mapbox-request-transformer@npm:0.0.2"
21450
+ checksum: 10c0/fb73e476a94039a884982e831060feae70977edba7963249bb8b924cdc72fdee29e1968710e026a45dcd4079b5c11477689f54d528ea0bd481aba47cc0ac924d
21451
+ languageName: node
21452
+ linkType: hard
21453
+
21446
21454
"markdown-escapes@npm:^1.0.0":
21447
21455
version: 1.0.4
21448
21456
resolution: "markdown-escapes@npm:1.0.4"
You can’t perform that action at this time.
0 commit comments