Loaders
Loaders turn a label and its image data into a PDS3Image or PDS4Image. Every loader is async.
Binary arguments accept any BinarySource: an ArrayBuffer, a typed array, a Node.js Buffer, a Blob or a File.
PDS3
loadPDS3Image
Loads a PDS3 image from in-memory data.
loadPDS3ImageByFile
Loads a PDS3 image from File / Blob objects. Note that the image comes first. Omit lblFile when the label is attached to imgFile.
Earlier versions took a single file and split it in half into label and data. That never matched how PDS3 files are laid out. A single argument is now read as an attached label.
loadPDS3ImageByUrl
Fetches the image and label in parallel. lblUrl defaults to imgUrl with the .IMG extension replaced by .LBL.
Throws if either response is not 2xx.
PDS4
loadPDS4Image
Loads a PDS4 image from in-memory data. label may be XML text or binary (decoded as UTF-8).
loadPDS4ImageByFile
Loads a PDS4 image from File / Blob objects: the XML label first, then the data file.
loadPDS4ImageByUrl
Fetches the label, then the data file. If imgUrl is omitted, it is resolved from File_Area_Observational/File/file_name, relative to xmlUrl.
Throws if a response is not 2xx, or if imgUrl is omitted and the label has no file_name.
Directories
These functions need the File System Access API, which is browser only.
loadPDSImageFromDirectory
Searches the directory (not recursively) and loads the first product found:
- an
.IMGfile and a.LBLfile with the same stem → PDS3 - an
.xmllabel whosefile_nameexists in the directory → PDS4
Throws if no product is found, or if a PDS4 label references a missing file.
loadPDSImageArrayBufferFromDirectory
Same as loadPDSImageFromDirectory, but returns the ArrayBuffer behind image.toFloat32Array().