1.1.0 • Published 1 year ago

giscatjs v1.1.0

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

insert

npm i giscatjs

or

<script src="../dist/giscat-js.js" type="text/javascript" charset="utf-8"></script>

ProtoFeature bytes to geojson object

function sendGet() {
    const req = new XMLHttpRequest();
    req.open("GET", "./data/testbytes.pbf", true);
    req.responseType = "arraybuffer";

    req.onload = () => {
        const arrayBuffer = req.response;
        if (arrayBuffer) {
            const bytes = new Uint8Array(arrayBuffer);// ProtoFeature bytes
            const fc = giscat.pojo.ProtoFeatureConverter.proto2featureCollection(bytes);
            console.log(fc) // obj
            console.log(JSON.stringify(fc)) // string
        }
    };
    req.send();
}

sendGet()