Decoding the GeoTIFF
Process to Decode GeoTIFF and Retrieve Tile
Using IPLD to resolve tile paths
We used the interface-ipld-format to figure out the utility functions for the IPLD Blocks. The following utility function in the js-ipld-dag-cbor package is:
const iter = await dagCBOR.resolver.tree(block.data);
The iterator iter
contained all possible paths , in the object to outline the tree. In order to access the serialized binary of the tile, we just have to use the corresponding path with its respective /data
tag.
Using resolver.resolve(binaryBlob, path)
,another utility function, we can take one of the paths in the Array and use it to query the data we need.
const path = '0,240,240,480/data';
const result = await dagCBOR.resolver.resolve(binary, path);
If we pass in a path with a /data
tag, the deserialized binary will represent the source raw binary of the tile. The serialized binary data of the Tile that we encoded earlier.
We need to deserialize the binary data in order to get back the source binary.
const raw_binary = await dagCBOR.util.deserialize(tile_binary.value);
After we get the data back to source binary we can use the binary data and some metadata in to write back into a TIFF, with writeArrayBuffer:
Last updated