Skip to content

Style GeoJSON layer according to embedded attributes #1802

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: 1 comment

Comment options

You must be logged in to vote
0 replies
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
1 participant