geomatico / maplibre-cog-protocol

Custom protocol to load Cloud Optimized GeoTIFFs (COG) in Maplibre GL JS
http://labs.geomatico.es/maplibre-cog-protocol/
MIT License
51 stars 6 forks source link

Add ability to provide a custom array of colors #12

Closed bameyrick closed 1 week ago

bameyrick commented 2 weeks ago

We'd love to use this library but be able to provide our own colors, so I've created this PR to enable providing either the existing ColorBrewer or CARTOColors scheme or an array of hex codes to the color hash.

e.g.

map.addSource('sourceId', {
    type: 'raster',
    url: 'cog://https://labs.geomatico.es/maplibre-cog-protocol/data/kriging.tif#color:["#ffeda0","#feb24c","#f03b20"],1.7,1.8,c',
  });
bameyrick commented 1 week ago

Hi! I've reduced the minimum hex codes for custom colors to 2 now, and added a demo page in the source