Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.
[feat] Pass in custom transformRequest function (#2534)
Igor Dykhta1f9757b8c697
diff --git a/src/components/src/kepler-gl.tsx b/src/components/src/kepler-gl.tsxindex 9ece2ba49..6fdd13a4c 100644--- a/src/components/src/kepler-gl.tsx+++ b/src/components/src/kepler-gl.tsx@@ -161,7 +161,10 @@ export const mapFieldsSelector = (props: KeplerGLProps, index: number = 0) => ({// mapStyletopMapContainerProps: props.topMapContainerProps,- bottomMapContainerProps: props.bottomMapContainerProps+ bottomMapContainerProps: props.bottomMapContainerProps,++ // transformRequest for Mapbox basemaps+ transformRequest: props.transformRequest});export function getVisibleDatasets(datasets) {@@ -317,6 +320,8 @@ type KeplerGLBasicProps = {topMapContainerProps?: object;bottomMapContainerProps?: object;++ transformRequest?: (url: string) => {url: string};};type KeplerGLProps = KeplerGlState & KeplerGlActions & KeplerGLBasicProps;diff --git a/src/utils/src/map-style-utils/mapbox-utils.ts b/src/utils/src/map-style-utils/mapbox-utils.tsindex 552ac7c47..cbb178729 100644--- a/src/utils/src/map-style-utils/mapbox-utils.ts+++ b/src/utils/src/map-style-utils/mapbox-utils.ts@@ -25,10 +25,7 @@ export function isStyleUsingMapboxTiles(mapStyle) {}export const transformRequest = (url: string): {url: string} => {- const isMapboxRequest =- url.slice(8, 22) === 'api.mapbox.com' || url.slice(10, 26) === 'tiles.mapbox.com';-return {- url: isMapboxRequest ? url.replace('?', '?pluginName=Keplergl&') : url+ url};};