Open exrhizo opened 1 month ago
I found a way to add style (looks weird though):
mapbox://styles/mapbox/streets-v12
https://gist.githubusercontent.com/exrhizo/0c6250cb76ae92558a8a37f8caad9c2a/raw/4733d20447b4d8acec8a125bcd6c9022681a75e8/osm-raster-style.json
https://github.com/keplergl/kepler.gl/assets/25113178/6227ced3-35fd-4cc8-9a85-deaba1fedf1f
🤯
I was able to get this to work programmatically:
export const BACKGROUND_LAYER_GROUP_SLUG = "Background";
export const BACKGROUND_LAYER_GROUP: DEFAULT_LAYER_GROUP = {
slug: BACKGROUND_LAYER_GROUP_SLUG,
filter: () => false,
defaultVisibility: false,
isVisibilityToggleAvailable: false,
isMoveToTopAvailable: false,
isColorPickerAvailable: true,
};
export function getOpenStreetMapStyles(): KeplerStyles {
const osmStyleJsonUrl = `${window.location.origin}/app/static/kepler/osm-raster-style.json`;
const style: KeplerStyles = {
osm_public: {
id: "osm_public",
label: "Open Street Map",
url: "",
icon: "https://a.tile.openstreetmap.org/0/0/0.png",
layerGroups: [BACKGROUND_LAYER_GROUP],
colorMode: "LIGHT",
style: {
version: 8,
name: "Open Street Map",
sources: {
openmaptiles: {
type: "raster",
tiles: [
"https://a.tile.openstreetmap.org/{z}/{x}/{y}.png",
"https://b.tile.openstreetmap.org/{z}/{x}/{y}.png",
"https://c.tile.openstreetmap.org/{z}/{x}/{y}.png",
],
tileSize: 256,
attribution:
'© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
},
},
layers: [
{
id: "simple-tiles",
type: "raster",
source: "openmaptiles",
minzoom: 0,
maxzoom: 19,
},
],
},
},
};
console.log("Kepler.App Using Open Street Map", { osmStyleJsonUrl, style });
return style;
}
mapStyles = getOpenStreetMapStyles();
keplerGlReducer.initialState({
mapStyle: {
mapStyles,
styleType,
}, ... })
Describe the bug My style json from mapbox docs doesn't load into the demo.
based my json on mapbox example
To Reproduce Steps to reproduce the behavior:
https://kepler.gl/demo
Expected behavior I can use a raster tile
Screenshots
Desktop (please complete the following information):