Skip to content

Instantly share code, notes, and snippets.

@nautilytics
Last active November 24, 2020 17:14
Show Gist options
  • Save nautilytics/c2b7b2e5184bafced797453c47e5edfa to your computer and use it in GitHub Desktop.
Save nautilytics/c2b7b2e5184bafced797453c47e5edfa to your computer and use it in GitHub Desktop.
A React Mapbox choropleth map generated from US Census Tract IDs using Mapbox Expressions
<ReactMapGL
...
mapStyle="mapbox://styles/graphicacy/<style_id>>"
mapboxApiAccessToken={ACCESS_TOKEN}
>
<Source id={LAYER_NAME} type="vector" url="mapbox://graphicacy.<dataset_id>" />
<Layer
type="fill"
id="fill_layer"
source={LAYER_NAME}
source-layer={LAYER_NAME}
paint={{
"fill-color": [
"step",
["get", "total_est"],
"#eff3ff", 36836,
"#c6dbef", 52390,
"#9ecae1", 69315,
"#6baed6", 91857,
"#4292c6", 120714,
"#2171b5", 166635,
"#084594", 250002,
"#fff"
],
"fill-opacity": 1
}}
/>
</ReactMapGL>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment