Published
Edited
Jan 12, 2019
Importers
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
{
// sample usage
const x = args.x * args.size;
const y = args.y * args.size;
return unproject(x, y, args.z)
}
Insert cell
unproject = (x, y, z) => {
const scale = 256 * Math.pow(2, z);
const p = {
x: (x / scale - 0.5) / S,
y: (y / scale - 0.5) / -S,
};
return {
lat: (2 * Math.atan(Math.exp(p.y / R)) - (Math.PI / 2)) * D,
lng: p.x * D / R,
};
}
Insert cell
Insert cell
Insert cell
Insert cell
{
// sample usage
const x = args.x * args.size;
const y = args.y * args.size;
const convertToWGS = unprojectFunc('+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs');
const convertToUTM = unprojectFunc('+proj=utm +zone=32N +ellps=WGS84 +datum=WGS84 +no_defs');
const wgs = convertToWGS(x, y, args.z);
const utm = convertToUTM(x, y, args.z);
return {
lat: wgs.y,
lng: wgs.x,
easting: utm.x,
northing: utm.y,
}
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
args = ({
x: 33810,
y: 19443,
z: 17,
size: 512,
})
Insert cell
Insert cell
Insert cell
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