visgl / visgl/react-map-gl

[Bug] Maplibre modification language is invalid.

Open
#2,536 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
8.5k
Forks
1.4k
Avg merge
5d 17h
Merged PRs (30d)
3

Description

Description

Maplibre modification language is invalid.

Expected Behavior

No response

Steps to Reproduce

import { Map, useControl } from "react-map-gl/maplibre";
import { ScatterplotLayer, type DeckProps } from "deck.gl";
import { MapboxOverlay } from "@deck.gl/mapbox";
import MapboxLanguage from "@mapbox/mapbox-gl-language";
function DeckGLOverlay(props: DeckProps) {
const overlay = useControl(() => new MapboxOverlay(props));
overlay.setProps(props);
return null;
}

export default function App() {
const layers = [
new ScatterplotLayer({
id: "deckgl-circle",
data: [{ position: [0.45, 51.47] }],
getPosition: (d) => d.position,
getFillColor: [255, 0, 0, 100],
getRadius: 1000,
beforeId: "watername_ocean", // In interleaved mode render the layer under map labels
}),
];
const THEME = {
dark: "-dark",
light: "-light",
pastel: "-pastel",
default: "",
};
const API_KEY = "dYcvRTJBE31231sE2z5LQ";
console.log(
https://api.maptiler.com/maps/streets-v2${THEME.dark}/style.json?key=${API_KEY}
);

return (
    <Map
        initialViewState={{
            longitude: 0.45,
            latitude: 51.47,
            zoom: 11,
        }}
        mapStyle={`https://api.maptiler.com/maps/streets-v2${THEME.dark}/style.json?key=${API_KEY}`}
        onLoad={(evt) => {
            const map = evt.target;
            // do something
            const language = new MapboxLanguage({
                defaultLanguage: "zh-Hans",
            });
            console.log(language);
            map.addControl(language);
        }}
    >
        <DeckGLOverlay layers={layers} />
    </Map>
);

}

Environment
  • Framework version:
  • Map library:
  • Browser:
  • OS:
Logs

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the supplied TypeScript App example with the Map component, its onLoad handler, and MapboxLanguage control. Inspect how the Map component exposes the underlying map and accepts controls; done means the reported Maplibre language modification error is reproduced, explained, and verified as resolved in the example.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.