1

I am new to Mapbox and love the simplicity of creating choropleth maps with stops, and while I prefer the way Mapbox colors each polygon relative to where the value falls between stops by blending the stop colors, I need to replicate maps created where colors are assigned according to value bins and have so far not found mapbox gl examples.

I mocked up a simple example of a 3-color map created in QGIS:

Choropleth QGIS

... and below is the same map as mapbox map with the same 3 colors and how I set the fill colors using stops. I think I need to use a mapbox expression that says something like "case when households between 0 and 10000 then #d7191c..." rather than using stops to replicate my QGIS map, but I'm not sure how.

"paint": {
    "fill-color": {
        property: "households",
        stops: [[0, '#d7191c'],
                [10000, '#ffffbf'],
                [25000, '#2b83ba']]
    }
}

Choropleth Mapbox

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.