Skip to content

Commit 13265f9

Browse files
committed
[feat] mapbox and maplibre simultaneous support
Signed-off-by: Ihor Dykhta <[email protected]>
1 parent cf02a3c commit 13265f9

File tree

27 files changed

+343
-107
lines changed

27 files changed

+343
-107
lines changed

bindings/kepler.gl-jupyter/js/lib/keplergl/components/app.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ function App() {
8484
rel="stylesheet"
8585
href="http://d1a3f4spazzrp4.cloudfront.net/kepler.gl/uber-fonts/4.0.0/superfine.css"
8686
/>
87+
<link
88+
rel="stylesheet"
89+
href="http://api.tiles.mapbox.com/mapbox-gl-js/v1.1.1/mapbox-gl.css"
90+
/>
8791
<link
8892
rel="stylesheet"
8993
href="https://unpkg.com/maplibre-gl@^3/dist/maplibre-gl.css"

bindings/kepler.gl-jupyter/js/webpack/build-html.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ module.exports = (rules, plugins) => ({
7575
inject: true,
7676
links: [
7777
'https://d1a3f4spazzrp4.cloudfront.net/kepler.gl/uber-fonts/4.0.0/superfine.css',
78+
'https://api.tiles.mapbox.com/mapbox-gl-js/v1.1.1/mapbox-gl.css',
7879
'https://unpkg.com/maplibre-gl@^3/dist/maplibre-gl.css'
7980
],
8081
scripts: [

examples/custom-map-style/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<meta charset='UTF-8' />
55
<title>kepler.gl demo</title>
66
<link rel="stylesheet" href="//d1a3f4spazzrp4.cloudfront.net/kepler.gl/uber-fonts/4.0.0/superfine.css">
7+
<link href="//api.tiles.mapbox.com/mapbox-gl-js/v1.1.1/mapbox-gl.css" rel="stylesheet">
78
<link href="https://unpkg.com/maplibre-gl@^3/dist/maplibre-gl.css" rel="stylesheet">
89
<style type="text/css">
910
body {margin: 0; padding: 0; overflow: hidden;}

examples/custom-reducer/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<meta charset='UTF-8' />
55
<title>kepler.gl demo</title>
66
<link href="//d1a3f4spazzrp4.cloudfront.net/uber-fonts/4.0.0/superfine.css" rel="stylesheet">
7+
<link href="//api.tiles.mapbox.com/mapbox-gl-js/v1.1.1/mapbox-gl.css" rel="stylesheet">
78
<link href="https://unpkg.com/maplibre-gl@^3/dist/maplibre-gl.css" rel="stylesheet">
89
<style type="text/css">
910
body {margin: 0; padding: 0; overflow: hidden;}

examples/custom-theme/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<meta charset='UTF-8' />
55
<title>kepler.gl demo</title>
66
<link rel="stylesheet" href="//d1a3f4spazzrp4.cloudfront.net/kepler.gl/uber-fonts/4.0.0/superfine.css">
7+
<link href="//api.tiles.mapbox.com/mapbox-gl-js/v1.1.1/mapbox-gl.css" rel="stylesheet">
78
<link href="https://unpkg.com/maplibre-gl@^3/dist/maplibre-gl.css" rel="stylesheet">
89
<style type="text/css">
910
body {margin: 0; padding: 0; overflow: hidden;}

examples/demo-app/dist/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<meta charset='UTF-8' />
55
<title>kepler.gl demo</title>
66
<link rel="stylesheet" href="//d1a3f4spazzrp4.cloudfront.net/kepler.gl/uber-fonts/4.0.0/superfine.css">
7+
<link href="//api.tiles.mapbox.com/mapbox-gl-js/v1.1.1/mapbox-gl.css" rel="stylesheet">
78
<link href="https://unpkg.com/maplibre-gl@^3/dist/maplibre-gl.css" rel="stylesheet">
89
<link rel="stylesheet" href="/bundle.css">
910
<style type="text/css">

examples/node-app/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<meta charset='UTF-8' />
55
<title>kepler.gl demo</title>
66
<link rel="stylesheet" href="//d1a3f4spazzrp4.cloudfront.net/kepler.gl/uber-fonts/4.0.0/superfine.css">
7+
<link href="//api.tiles.mapbox.com/mapbox-gl-js/v1.1.1/mapbox-gl.css" rel="stylesheet">
78
<link href="https://unpkg.com/maplibre-gl@^3/dist/maplibre-gl.css" rel="stylesheet">
89
<style type="text/css">
910
body {margin: 0; padding: 0; overflow: hidden;}

examples/open-modal/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<meta charset='UTF-8' />
55
<title>kepler.gl demo</title>
66
<link rel="stylesheet" href="//d1a3f4spazzrp4.cloudfront.net/kepler.gl/uber-fonts/4.0.0/superfine.css">
7+
<link href="//api.tiles.mapbox.com/mapbox-gl-js/v1.1.1/mapbox-gl.css" rel="stylesheet">
78
<link href="https://unpkg.com/maplibre-gl@^3/dist/maplibre-gl.css" rel="stylesheet">
89
<style type="text/css">
910
body {margin: 0; padding: 0; overflow: hidden;}

examples/umd-client/index.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
/>
1212

1313
<!--MapBox css-->
14+
<link href="https://api.tiles.mapbox.com/mapbox-gl-js/v1.1.1/mapbox-gl.css" rel="stylesheet" />
1415
<link href="https://unpkg.com/maplibre-gl@^3/dist/maplibre-gl.css" rel="stylesheet" />
1516

1617
<!-- Load React/Redux -->
@@ -88,8 +89,8 @@
8889
/** END STORE **/
8990

9091
/** COMPONENTS **/
91-
const KeplerElement = (function(react, keplerGl, mapboxToken) {
92-
return function(props) {
92+
const KeplerElement = (function (react, keplerGl, mapboxToken) {
93+
return function (props) {
9394
return react.createElement(
9495
'div',
9596
{style: {position: 'absolute', left: 0, width: '100vw', height: '100vh'}},

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@
183183
"jest-environment-jsdom": "^29.5.0",
184184
"jsdom": "^24.1.1",
185185
"json-loader": "^0.5.4",
186+
"mapbox-gl": "1.13.1",
186187
"maplibre-gl": "^3.6.2",
187188
"minimist": "^1.2.6",
188189
"nyc": "^15.1.0",

src/components/src/common/styled-components.tsx

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -533,11 +533,24 @@ export const StyledMapContainer = styled.div`
533533
display: none;
534534
}
535535
}
536+
.mapboxgl-map {
537+
.mapboxgl-missing-css {
538+
display: none;
539+
}
540+
.mapboxgl-ctrl-attrib {
541+
display: none;
542+
}
543+
}
536544
`;
537545

538-
export const StyledAttrbution = styled.div.attrs({
539-
className: 'maplibre-attribution-container'
540-
})`
546+
export type StyledAttrbutionProps = {
547+
mapLibCssClass: string;
548+
mapLibAttributionCssClass: string;
549+
};
550+
551+
export const StyledAttrbution = styled.div.attrs<StyledAttrbutionProps>(props => ({
552+
className: props.mapLibAttributionCssClass
553+
}))<StyledAttrbutionProps>`
541554
bottom: 0;
542555
right: 0;
543556
position: absolute;
@@ -567,7 +580,7 @@ export const StyledAttrbution = styled.div.attrs({
567580
align-items: center;
568581
color: ${props => props.theme.labelColor};
569582
570-
a.maplibregl-ctrl-logo {
583+
a.${props => props.mapLibCssClass}-ctrl-logo {
571584
width: 72px;
572585
margin-left: 4px;
573586
background-size: contain;

src/components/src/kepler-gl.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ const GlobalStyle = styled.div`
109109
.maplibregl-ctrl .maplibregl-ctrl-logo {
110110
display: none;
111111
}
112+
113+
.mapboxgl-ctrl .mapboxgl-ctrl-logo {
114+
display: none;
115+
}
112116
`;
113117

114118
type BottomWidgetOuterProps = {

0 commit comments

Comments
 (0)