Coder Social home page Coder Social logo

Comments (5)

pka avatar pka commented on May 30, 2024

I think, Mapbox GL doesn't offer this functionality You can set a color as function of a field value, but I don't find a way to use the field value as color directly.

[tileset.layer.style]
  type = "line"
  [tileset.layer.style.paint.line-color]
  property = "z_order"
  stops = [{ in = 0, out = "#d8e8c8" }, { in = 3, out = "#cc0000" }]

BTW, when you click on the Maputnik link in the backend, you can experiment with the Mapbox style and translate the generated JSON to TOML afterwards.

from t-rex.

pka avatar pka commented on May 30, 2024

Correction: according to https://www.mapbox.com/mapbox-gl-js/example/data-driven-lines/ it could be possible:

[tileset.layer.style]
  type = "line"
  [tileset.layer.style.paint.line-color]
  property = "colour"
  type = "identity"

But when testing with a string field, I always get TypeError: m is undefined

from t-rex.

kiambogo avatar kiambogo commented on May 30, 2024

After hitting my for a while, I found out the issue is just in the Mapbox GL viewer within your viewer.js. I updated the viewer to use Mapbox GL JS 0.38, but that still did not fix it. If I use vanilla mapbox 0.38 in a static HTML file pointing to t-rex (like the snippet), I get the expected result.

Huge thanks for your help! :D

from t-rex.

pka avatar pka commented on May 30, 2024

Will try to fix that when updating the built-in Mapbox viewer.

from t-rex.

pka avatar pka commented on May 30, 2024

Fixed in 9641c7a

from t-rex.

Related Issues (20)

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.