Published unlisted
Edited
Apr 8, 2021
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
mutable totalLimeRequired = 0
Insert cell
L = require("leaflet")
Insert cell
leafletShades = await require("leaflet-shades/dist/leaflet-shades")
Insert cell
html`<link href='${resolve('leaflet/dist/leaflet.css')}' rel='stylesheet' />`
Insert cell
html`<link href='${resolve('leaflet-shades/src/css/leaflet-shades.css')}' rel='stylesheet' />`
Insert cell
geotiff = require("geotiff")
Insert cell
plotty = require("plotty/dist/plotty.js")
Insert cell
Insert cell
Insert cell
Insert cell
function pixelFromLatLng(image, [lat, lng]) {
// from http://geoexamples.com/d3-raster-tools-docs/intr/geotransform.html
let GT = geoTransform(image);
// N.B. swap lat/lng from coordinates to pixel X/Y
let Xpixel = (lng - GT[0]) / GT[1];
let Ypixel = (lat - GT[3]) / GT[5];
return [Math.floor(Xpixel), Math.floor(Ypixel)];
}
Insert cell
function geoTransform(image) {
// equation from http://geoexamples.com/d3-raster-tools-docs/intr/reading-raster-data.html
let tiepoint = image.getTiePoints()[0];
let pixelScale = image.getFileDirectory().ModelPixelScale;
return [tiepoint.x, pixelScale[0], 0, tiepoint.y, 0, -1*pixelScale[1]];
}
Insert cell
THREE = {
const THREE = window.THREE = await require("three/build/three.min.js");
await require("three/examples/js/controls/OrbitControls.js").catch(() => {});
return THREE;
}
Insert cell
proj4 = require('proj4')
Insert cell
import {legend, swatches} from "@d3/color-legend"
Insert cell
d3 = require("d3@6")
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more