I needed to make a categorical color scale to display in a legend for a web map. The legend symbolizes data displayed as a Leaflet tile layer, the tiles being cut from raster data. The original raster data was styled using GDAL's gdaldem
color-relief
tool with a color.txt file that defined a color ramp (see colors.txt and carbon.txt).
The idea here is to take that color.txt
file used by GDAL and generate a visual categorical color ramp from it to display in the web map (sold separately).
Built with blockbuilder.org
https://d3js.org/d3.v4.min.js