Skip to content
Tom edited this page Sep 21, 2021 · 7 revisions

Classes

GBX

Create a GBX instance

Parameters:

Name Type Description
options Object See options

Example:

var GBX = new GBX({
    data: myInput,
    thumbnail: "base64",
    onParse: function(metadata) {
        console.log(metadata);
    }
});

options

Name Type Default value Description
data File, Blob, Uint8Array Required. Data to parse.
force Boolean false If true, do not check whether data is using a supported type and parse anything. Important for Node.js usage.
thumbnail Boolean false If true, do not skip the thumbnail chunks and include them in the result.
String If base64, convert the thumbnail output to base64 (not compatible with Node.js).
onParse Function See onParse
onThumb Function See onThumb

Functions

onParse

Executes after the parsing (without the thumbnail) has been completed.

Parameters:

Name Type Description
metadata Array An array composed with every information point of the headers parsed from the data. See the GBX Reference for a list.
errorMsg String Returns empty, unless the parsing failed. Learn how to handle errors.
headerChunks Array The compiled header chunks in an array. For debugging purposes.
classID Number The class ID (identifies what GBX type the parser detected) used by the compiler. For debugging purposes.

onThumb

Executes after the thumbnail has been parsed. Only available if thumbnail is not set to false.

Parameters:

Name Type Description
thumbnail Array If thumbnail is true, it will return an Array with bytes composing the thumbnail of the map.
String If thumbnail is base64 , it will return a string useable as Data URL (not compatible with Node.js).
thumbnailSize Number The size of the thumbnail in bytes.
headerChunks Array The compiled header chunks in an array. For debugging purposes.