Class: AAIGridReader

AAIGridReader(dataSource)

Parses an AAIGrid and creates a typed array with its values.

Constructor

new AAIGridReader(dataSource)

Constructs an AAIGrid reader object for the specified data source. Call getImageData to retrieve the data as a typed array. Use metadata to access the metadata of this AAIGrid.
Parameters:
Name Type Description
dataSource String | ArrayBuffer The data source for the AAIGrid.
Source:
Throws:
If the specified data source is not a string or an array buffer.
Type
ArgumentError

Members

(readonly) metadata :AAIGridMetadata

An object containing the metadata of the AAIGrid file.
Type:
Source:

Methods

(static) retrieveFromUrl(url, parserCompletionCallback)

Attempts to retrieve the AAIGrid data from the provided URL, parse the data and return an AAIGridReader using the provided parserCompletionCallback.
Parameters:
Name Type Description
url String An URL pointing to an external resource.
parserCompletionCallback function A function to execute when the retrieval finishes, taking two arguments:
  • AAIGridReader instance in case of success, otherwise null
  • XMLHttpRequest instance
Source:

decodeData(dataSource) → {String}

Internal. Applications should not call this method. Decodes an arrayBuffer as a string. If the dataSource is a string, no decoding takes place, the string is immediately returned.
Parameters:
Name Type Description
dataSource String | ArrayBuffer The data source to decode.
Source:
Throws:
If the specified data source is not a string or an array buffer.
Type
ArgumentError
Returns:
The decoded array buffer.
Type
String

getImageData() → {Int16Array|Float32Array}

Returns the content of the AAIGrid as an Int16Array or Float32Array.
Source:
Returns:
The content of the AAIGrid.
Type
Int16Array | Float32Array

parse(dataString)

Internal. Applications should not call this method. Parses the AAIGrid.
Parameters:
Name Type Description
dataString String The string to parse.
Source:
Throws:
If the specified data source is not a string.
Type
ArgumentError