Platform
Resources
Pricing
Sign in
Contact us
Jamie Collinson
Workspace
Fork
Published unlisted
By
Jamie Collinson
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.
Try it for free
Learn more
Fork
View
Export
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
map
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
container
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Pin
Add comment
Select
Duplicate
Copy link
Embed
Delete
Edit
Pin
Add comment
Select
Duplicate
Copy link
Embed
Delete
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
topLeft
Edit
Pin
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
bottomRight
Edit
Pin
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
pageWidth
Edit
Pin
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
totalLimeRequired
Unpin
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
L
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
leafletShades
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
geotiff
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
plotty
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
setupLeafletShades
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
plotHref
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
pixelFromLatLng
Unpin
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
geoTransform
Unpin
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
THREE
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
proj4
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
d3
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
JavaScript
Markdown
HTML
JavaScript
Markdown
HTML
JavaScript
Markdown
HTML