This work is licensed under a Creative Commons Attribution 4.0 International License.
Scientific Raster Data Exploration
EO Acquisitions/Model Data
Prerendered
Server-Side On-Demand Rendering
Fully interactive raster exploration
HTML / JavaScript only
Integration with Web-Mapping Frameworks
Canvas API
Web GL
Typed Arrays
Transfer Raster Data
Raster Rendering
Browsers usually only support RGB(A) (JPEG/PNG)
Workaround - encode Float/Int as RGBA
Various Drawbacks:
Good software support
Flexible (Thousand Incompatible File Formats)
Extensible
Geographic Metadata
WCS - GeoTIFF application profile
Pure JavaScript (ECMAScript 2015) implementation
Typed Arrays + DataViews
fetch('data/rgba.tiff')
.then(function(response) { return response.arrayBuffer(); })
.then(function(buffer) {
var tiff = GeoTIFF.parse(buffer);
var image = tiff.getImage();
var ctx = document.getElementById('canvas').getContext('2d');
var imageData = ctx.createImageData(
image.getWidth(), image.getHeight());
var pixels = image.readRasters({ interleave: true });
for (var i = 0; i < pixels.length; ++i) {
imageData.data[i] = pixels[i];
}
ctx.putImageData(imageData, 0, 0);
});
Enter plotty...
Small JavaScript library to render rasters
Colorscales
WebGL / "Software" renderer
var width = 100, height = 100, xoff = width / 3, yoff = height / 3;
var data = new Float32Array(height * width);
for (y = 0; y <= height; y++) {
for (x = 0; x <= width; x++) {
x2 = x - xoff; y2 = y - yoff;
t = Math.sin(Math.sqrt(x2*x2 + y2*y2)/6.0);
data[(y*width)+x] = t;
}
}
plot = new plotty.plot({
canvas: document.getElementById('canvas'),
data: data, width: width, height: height,
domain: [-1, 1], colorScale: 'viridis'
});
plot.render();
Colorscale | ||
Min | ||
Max | ||
Clamp Low | ||
Clamp High |
geotiff.js: Compression: LZW and Deflate
plotty.js: Performance, Additional Interpolations
Integrations with OpenLayers, Leaflet and Cesium
Any Questions?
Slides: https://constantinius.github.io/foss4g-geotiff.js-plotty.js/