Public
Edited
Oct 4, 2024
4 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
rotate = [9, -40]
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
html`<link href='${resolve(
"leaflet@1.2.0/dist/leaflet.css"
)}' rel='stylesheet' />`
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
function decToDMS(decimalCoords) {
let lng = decimalCoords[0];
let lat = decimalCoords[1];

let lngDMS = decDegToDMS(lng, true);
let latDMS = decDegToDMS(lat, false);

return latDMS + " " + lngDMS;
}
Insert cell
// from https://gist.github.com/mbykovskyy/1c67b0b4ba8da9972488 - thanks @mbykovskyy!
function decDegToDMS(dd, isLng) {
var dir = dd < 0 ? (isLng ? "W" : "S") : isLng ? "E" : "N";

var absDd = Math.abs(dd);
var deg = absDd | 0;
var frac = absDd - deg;
var min = (frac * 60) | 0;
var sec = frac * 3600 - min * 60;
// Round it to 2 decimal points.
sec = Math.round(sec * 100) / 100;
return deg + "°" + min + "'" + sec + '"' + dir;
}
Insert cell
function decDegToRad(decimalCoords) {
return decimalCoords.map((c) => (c * Math.PI) / 180);
}
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