Skip to content

How to style GeoJSON layer according to embedded attributes #1084

Answered by rsurgiewicz
rsurgiewicz asked this question in Q&A
Discussion options

You must be logged in to vote

Ok finally I got it right.
Actually there's a possibility to use get feature to grab value from data.

so in my example

...      },
      "properties": {
        "fill": "#18ff00",
        "fill-opacity": 0.5,
        "stroke-width": 0.5,
        "stroke": "#8f8f8f"
      }

it would be something like:

  id: "data",
  type: "fill",
  paint: {
    "fill-color": ["get", "fill"],
    "fill-opacity": 0.8,
  },
};

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@lulumalik
Comment options

Answer selected by rsurgiewicz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants