-
Notifications
You must be signed in to change notification settings - Fork 14
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
Text field of GeoJSON symbol layer not visible #71
Comments
Hello @mschefer thanks for pointing out this issue, I'll look into it and let you know. |
Hello again @mschefer , as I was investigating it, I found the issue, but it is not solved yet. In the meantime, I can suggest a temporary workaround that consists in moving the language setting from the constructor to the beginning of the const map = new Map({
apiKey: "my-key",
center: [8.539, 47.36],
zoom: 15,
container: "my-container",
style: "bright-v2",
});
map.on("load", () => {
map.setLanguage("name:en");
// You can also use the language enum:
// map.setLanguage(maptilersdk.Language.ENGLISH);
map.addSource("my-source", {
type: "geojson",
data: {
type: "Feature",
geometry: {
type: "Point",
coordinates: [8.539, 47.36],
},
},
});
map.addLayer({
id: "example-text",
type: "symbol",
source: "my-source",
layout: {
"text-field": "Hello, World",
"text-font": ["Open Sans Semibold"],
},
});
}); I will try to come up with a more elegant solution for our next release, this week or the next. |
Ok, thank you. |
Hello @mschefer , the version 2 of the SDK is now published and contains the fix. Be aware that this version is also an update with MapLibre v4 that is a major update with many callback logic replaced by async/await so it may impact your app. |
If you add a symbol layer with a
"text-field"
to the map immediately after theload
event is fired, the text field is not visible if thelanguage
parameter is set on the map. The issue may be some kind of race condition, because if the layer is added with a short delay (~50ms) after theload
event, the text field is visible.If the
language
parameter isundefined
the issue does not occur.The following example can be used to reproduce the issue:
The text was updated successfully, but these errors were encountered: