COG Mate

COGMate can be used for working with Cloud Optimized GeoTiff's (COG). Add, remove, show, hide a COG from any LeafletJS map. Allows for multi-band pixel math. Multiple palette styles, grayscale, gradient, colorStop, Look-Up Table. Allows color mapping values to colors. This is a wrapper around georaster-layer-for-leaflet for extended functionality and ease of use. Documentation at the bottom.

(Gradient palette with color mapped values using a single 1.8GB 30 meter elevation COG)

cross hair

Here are some examples using LeafletJS and the minimum JavaScript required:

(A simple green footprint of the elevation COG)

var map = L.map('map', {
   center: { lat: 39, lng: -95 }
   ,zoom: 4
});
let dem30m = new COGMate(map, { 
   url: "https://www.femafhz.com/map/data/raster/conusDem30m_cog.tif" 
});
dem30m.addLayer();

(grayscale example)

var map = L.map('map', {
   center: { lat: 39, lng: -95 }
   ,zoom: 4
});
let dem30m = new COGMate(map, { 
   url: "https://www.femafhz.com/map/data/raster/conusDem30m_cog.tif" 
   ,minValue: -114
   ,maxValue: 4410
   ,paletteFn: 'grayscale'
});
dem30m.addLayer();

(code for the interactive map above)

var map = L.map('map', {
   center: { lat: 39, lng: -95 }
   ,zoom: 4
});

let dem30m = new COGMate(map, { 
   id: "dem30m"
   ,url: "https://www.femafhz.com/map/data/raster/conusDem30m_cog.tif"
   ,minZoom: 1
   ,maxZoom: 18
   ,valueScaleFn: function (m = 0) { return parseInt(m * 3.28084); }
   ,minValue: -1000
   ,maxValue: 15000
   ,values: '-1000,3,25,100,500,1000,1500,2000,3000,4000,5000,6000,7000,8000,9000,10000,11000,12000,13000,14000,15000'
   ,colors:'#284083,#364f86,#516e8b,#6c8c91,#87aa96,#9dc39b,#b7d7a8,#d2e5bc,#e7f1cc,#f6f9d8,#fcfcdc,#fcf8d5,#fbefc8,#f5e2b8,#ead4aa,#ddc39a,#cfb289,#c19e76,#b18a63,#a1754f,#986a44'
   ,paletteFn: 'gradient'
   ,attribution: '<a href="https://www.usgs.gov" target="_blank">USGS<a>'
});
dem30m.addLayer();

Documentation
Requires georaster-layer-for-leaflet

That's it!