You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Was hoping to be able to place flatgeobuf into a webworker and provide range requests/filtered requests from arbitrary serialized geojson features.
However, the range request feature with spatial filter seems directly tied to the HTTP/request system.
Reviewing the code, it looks tightly coupled.
It seems like it should just be given an interface that returns various slices of data from . Is it possible to make a cheap object interface that can be substituted for the <url> input.
The text was updated successfully, but these errors were encountered:
import rangeParser from 'range-parser' // npm package
//handler...
function appendToUint8Array(arr, data) {
const newArray = new Uint8Array(arr.length + data.length)
newArray.set(arr) // copy old data
newArray.set(data, arr.length) // copy new data after end of old data
return newArray
}
const fcFgb = ...data
if (fetchOpts?.headers) {
let chunks
for (const header of Object.keys(fetchOpts.headers)) {
if (header.toLowerCase() === 'range') {
const parser = rangeParser(fcFgb.length, fetchOpts.headers[header])
chunks = new Uint8Array()
for (const { start, end } of parser) {
const chunk = fcFgb.slice(start, end)
chunks = appendToUint8Array(chunks, chunk)
console.log('range', { start, end })
}
}
}
if (chunks) {
fcFgb = chunks
}
}
return new Response(fcFgb, {
status: 200,
headers: {
'content-type': 'application/vnd.flatgeobuf',
},
})
Was hoping to be able to place flatgeobuf into a webworker and provide range requests/filtered requests from arbitrary serialized geojson features.
However, the range request feature with spatial filter seems directly tied to the HTTP/request system.
Reviewing the code, it looks tightly coupled.
It seems like it should just be given an interface that returns various slices of data from . Is it possible to make a cheap object interface that can be substituted for the
<url>
input.The text was updated successfully, but these errors were encountered: