Published
Edited
Apr 13, 2022
1 star
Insert cell
Insert cell
JSZip.loadAsync(kmzBase64, { base64: true })
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
bytesEncodedWithOffset = String.fromCharCode(...bytes.map((d) => d + charCodeOffset))
Insert cell
Insert cell
Insert cell
function deserializeWithOffset(bytesEncodedWithOffset, charCodeOffset) {
const n = bytesEncodedWithOffset.length;
const bytes = new Uint8Array(n);
for (let i = 0; i < n; ++i) {
bytes[i] = bytesEncodedWithOffset.charCodeAt(i) - charCodeOffset;
}
return bytes;
}
Insert cell
decodedBytes = deserializeWithOffset(bytesEncodedWithOffset, charCodeOffset)
Insert cell
Insert cell
JSZip.loadAsync(decodedBytes)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
deserializeWithOffset(bytesEncodedWithOffset0, 0)
Insert cell
Insert cell
<style>
span.code {
font-family: monospace;
font-size: 0.9em;
background-color: #f3f3f3;
padding: 0.2em;
border-radius: 0.2em;
}
</style>
Insert cell
JSZip = (await import("https://cdn.skypack.dev/jszip@3.9.1?min")).default
Insert cell
bytesJsonStringified = FileAttachment(
"kmz bytes google apps script json stringified.txt"
).text()
Insert cell
bytes = JSON.parse(bytesJsonStringified)
Insert cell
kmzBase64 = FileAttachment("kmzBase64.txt").text()
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