-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MapLibre basemap #2461
MapLibre basemap #2461
Conversation
6eb76ca
to
ac5a62a
Compare
That was quick. I will try to get reviewers eyes on to this asap!
No, the deck v9 upgrade is going to be the base of the kepler.gl 4.0 release. It is going to require a major lift. |
@@ -104,7 +104,7 @@ function App() { | |||
/> | |||
<link | |||
rel="stylesheet" | |||
href="http://api.tiles.mapbox.com/mapbox-gl-js/v1.1.1/mapbox-gl.css" | |||
href="https://unpkg.com/maplibre-gl@^3/dist/maplibre-gl.css" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Q: Have you tested the jupyter integration?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, in general I had a hard time running the examples and would love some help with that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How can I test the jupyter bindings locally?
@@ -22,8 +22,8 @@ import React from 'react'; | |||
import ReactDOM from 'react-dom/client'; | |||
import document from 'global/document'; | |||
import {Provider} from 'react-redux'; | |||
import store from './store'; | |||
import App from './app'; | |||
import store from './store.ts'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like you have some editor that auto sorts imports, package.json etc (or perhaps it just your good habita). But this makes the PR bigger than it has to be and can conflict with other users. Is it possible to avoid these changes? Alternatively get those landed first so the functional change set is smaller.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I tried to run this example, and got an error that it couldn't find the 'store' and 'app', and it worked when I added the extensions. Will make a PR just for that, and some of the other minor changes that are unrelated to maplibre.
import keplerGlReducer, {enhanceReduxMiddleware} from '@kepler.gl/reducers'; | ||
import { configureStore } from '@reduxjs/toolkit'; | ||
import { StoreEnhancer } from 'redux'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@macrigiuseppe Need your review on these redux changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for context - createStore had a deprecation warning, and a IDE note to use configureStore. It's another thing that can be pulled to another PR if it's easier, because there are many other cases where the createStore is used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -1,3 +1,23 @@ | |||
// Copyright (c) 2023 Uber Technologies, Inc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file was contributed recently long after Uber stopped contributing and transferred ownership to OpenJS foundation. @igorDykhta @macrigiuseppe I assume it is an automated script that adds this, can we disable that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OpenJS Foundation council clarified we no longer need to carry forward the Uber copyright and instead use "Copyright contributors to the kepler.gl project" (without years)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opened #2467
colorMode: BASE_MAP_COLOR_MODES.NONE | ||
} | ||
|
||
// { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@macrigiuseppe I assume we do need counterparts to all of these in order to load saved maps?
@@ -315,47 +315,57 @@ export const DEFAULT_MAP_STYLES: { | |||
{ | |||
id: 'dark', | |||
label: 'Dark', | |||
url: 'mapbox://styles/uberdata/cjoqbbf6l9k302sl96tyvka09', | |||
url: 'https://api.maptiler.com/maps/b989b458-e075-497d-9a86-3035fd08bd7c/style.json?key=17oUJVO01Blh1QOfWftj', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe at least the default should be Carto's Dark Matter. It doesn't look that pretty, but it doesn't require setting up an account and creating styles by any particular user. Using a MapTiler account would imply map load limits on their free tier.
Alternatively, we could try to reach out to MapTiler (they say that they love open-source) asking to provide an unlimited key for kepler.
@heshan0131 what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reaching out to maptiler seems like a nice thing to do, however in the interest of landing this PR quickly, I would say let's keep things separate and let's just add the unconstrained CARTO styles as defaults for now.
Ideally, users of the kepler.gl framework can easily reconfigure the styles.
@@ -141,15 +141,16 @@ const MAPBOXGL_STYLE_UPDATE = 'style.load'; | |||
const MAPBOXGL_RENDER = 'render'; | |||
const nop = () => {}; | |||
|
|||
const MapboxLogo = () => ( | |||
const MapLibreLogo = () => ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should use react-map-gl's AttributionControl
instead. Right now there's no mention of MapTiler or Carto in the attribution when their maps are used. I assume that would mean breaching their licenses.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be not a logo but a small attribution text (this is from a deck.gl example ).
.
For some reason this seems to have been lost in the kepler.gl baseline (presumably not an issue with this PR): #2462. If so we could land this and fix that separately. Or fix that first, and rebase to make sure maplibre doesn't clobber it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we remove this code in styled-components.tsx
(which hides the default attribution):
.maplibregl-ctrl-attrib {
display: none;
}
and then also remove this in map-container.tsx
:
{this.props.primary ? (
<Attribution
showMapboxLogo={this.state.showMapboxAttribution}
showOsmBasemapAttribution={true}
datasetAttributions={datasetAttributions}
/>
) : null}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using AttributionControl
is actually not required for that. Only if we want to add customAttribution
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anyways, we should probably rework the attribution rendering, and it can be done in a separate PR.
@birkskyum can you update the styles to use CARTO's free basemaps? https://github.com/CartoDB/basemap-styles
|
It's updated now, and will load DarkMatter by default to avoid a white blank canvas. |
@birkskyum Looks like we are starting to get approvals. To prepare for landing, we should get CI to run green.
|
4a0d994
to
1890467
Compare
There are a few things:
|
I don't fully understand the remaining "smoothie_the_cat" / bottomMapStyle / topMapStyle tests that are failing. If anyone has experience or input to that, it would be appreciated. |
@igorDykhta can you look at these? |
Interesting, locally I only have the 7 tests failing from MAP_STYLE_CHANGE, but on CI there are 26... don't know what causes the difference. |
fdf3ab0
to
1aa4cd9
Compare
Rebased. To ease the review have I reduce the number of changes in this PR, by bumping luma.gl separately (#2463), and reverting some changes caused by IDE auto-formatting. |
Signed-off-by: Birk Skyum <birk.skyum@pm.me>
Signed-off-by: Birk Skyum <birk.skyum@pm.me>
Signed-off-by: Birk Skyum <birk.skyum@pm.me>
Signed-off-by: Birk Skyum <birk.skyum@pm.me>
Signed-off-by: Birk Skyum <birk.skyum@pm.me>
Signed-off-by: Birk Skyum <birk.skyum@pm.me>
Signed-off-by: Birk Skyum <birk.skyum@pm.me>
Signed-off-by: Birk Skyum <birk.skyum@pm.me>
Signed-off-by: Birk Skyum <birk.skyum@pm.me>
Signed-off-by: Birk Skyum <birk.skyum@pm.me>
Signed-off-by: Birk Skyum <birk.skyum@pm.me>
Signed-off-by: Birk Skyum <birk.skyum@pm.me>
Signed-off-by: Birk Skyum <birk.skyum@pm.me>
Signed-off-by: Birk Skyum <birk.skyum@pm.me>
Signed-off-by: Birk Skyum <birk.skyum@pm.me>
b24f71a
to
056e9d0
Compare
@birkskyum Appreciated! @igorDykhta is trying to get some attention on the test failures so that we can land this asap, before we publish kepler.gl 3.0. |
@birkskyum Style previews are black for me |
yes, in order to give a preview thumbnails have to be generated and linked. the mapbox style service had an endpoint with a thumbnail, so that is a bit different |
I have landed this to make sure it makes it as part of kepler.gl 3.0 release this Thursday. If possible please add any remaining polish in separate PRs asap. |
@ibgreen , The one existing thumbnail (NO_BASEMAP.png) is stored in this bucket: https://studio-public-data.foursquare.com/statics/keplergl/geodude/NO_BASEMAP.png I have generated thumbnails for the 6 new styles (400px X 300px). Is it possible to drop them there as well? |
Signed-off-by: Chris Gervang <chris@gervang.com>
@birkskyum Added thumbnails to the CDN. |
@igorDykhta , thanks! there is a pr to apply them here: |
closes #2460 cc @ibgreen
This makes the initial move to maplibre, to get the ball rolling, but it's not complete yet as outlined below. The demo app appear to work just fine. The examples folder doesn't use the local build, but instead a pinned kepler.gl version, so I haven't tried all of them yet.
New styles (and thumbnails) will be needed to replace the "uberdata" ones, since the mapbox styles with their proprietary mapbox:// syntax aren't supported. That is an area I'll need your help with completing. I made a quick darkblue style with maptiler, which is shown in the image below, and carto also has some free ones available (added the dark-matter one).
The GPU layers should work as well now in supported browsers, because maplibre v3 has webgl2 support, and a webgl1 fallback.