Coder Social home page Coder Social logo

Comments (4)

jonathanlurie avatar jonathanlurie commented on August 23, 2024 1

Hello @mschefer thanks for pointing out this issue, I'll look into it and let you know.

from maptiler-sdk-js.

jonathanlurie avatar jonathanlurie commented on August 23, 2024

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 load callback:

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.

from maptiler-sdk-js.

mschefer avatar mschefer commented on August 23, 2024

Ok, thank you.

from maptiler-sdk-js.

jonathanlurie avatar jonathanlurie commented on August 23, 2024

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.

from maptiler-sdk-js.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.