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

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more