Skip to content

Commit

Permalink
updated files
Browse files Browse the repository at this point in the history
  • Loading branch information
joric committed Dec 22, 2024
1 parent e762b9c commit b9492de
Showing 1 changed file with 0 additions and 37 deletions.
37 changes: 0 additions & 37 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -435,41 +435,6 @@
return [baseLayers, overlayLayers];
}

async function fetchAndDecompressGz(url) {
try {
// Fetch the .gz file
const response = await fetch(url);
if (!response.ok) throw new Error(`HTTP error! Status: ${response.status}`);

// Read the response as an ArrayBuffer
const buffer = await response.arrayBuffer();

// Create a ReadableStream from the ArrayBuffer
const readableStream = new Response(buffer).body;

// Decompress the data using CompressionStream
const decompressionStream = new DecompressionStream('gzip');
const decompressedStream = readableStream.pipeThrough(decompressionStream);

// Decode the decompressed data to text
const reader = decompressedStream.getReader();
const textDecoder = new TextDecoder();
let result = '';
let done, value;

while ({ done, value } = await reader.read(), !done) {
result += textDecoder.decode(value, { stream: true });
}
result += textDecoder.decode(); // finish the decoding

let data = JSON.parse(result);
loadMarkers(data);

} catch (error) {
console.error('Error:', error);
}
}

function updateCount() {
let update = ()=> {
let el = document.querySelector('.search-count');
Expand Down Expand Up @@ -786,8 +751,6 @@
map.removeLayer(markersLayer);
}

//fetchAndDecompressGz('markers.gz'); // github pages already compress jsons

fetch('markers.json').then(r=>r.json()).then(data=>loadMarkers(data))

map.on('baselayerchange', function(e) {
Expand Down

0 comments on commit b9492de

Please sign in to comment.