code0x00
code0x00

Reputation: 683

How to set circle-color using filters in mapbox data-expression?

Want to show different colored circles on the map using mapbox-gl-js.

Currently it is possible to show different colors using:

  'circle-color': [
      "case",
      [">=", ["get", 'count'], 12],
      "#000000",
      "#ffffff"
   ]

, but need to perform multiple filter to be performed for single color.

need something like:

[">=", ["get", 'count'], 120], && ["<=", ["get", 'count'], 200],

and if above results to true show red color circle.

Upvotes: 0

Views: 174

Answers (1)

Steve Bennett
Steve Bennett

Reputation: 126517

You want the all expression:

   ["all",
      [">=", ["get", 'count'], 120], 
      ["<=", ["get", 'count'], 200],
   ]

Upvotes: 0

Related Questions