Geospatiale I or Geospatiale 1.0 is the first-generation GIS file and format conversion system introduced in Universal Framework. It is succeeded by Geospatiale II. Documentation on each file/pseudo-class is provided below, broken up into two sections: Files (which refer to geospatial file I/O operations) and Formats (which refer to visualised instances from various web libraries.
Geospatiale I supports .asc, .csv, .geojson, GeoPNGs (.png), .nc, GeoTIFF (.tif/.tiff), GeoJSON, Maptalks, Naissance, Turf.js, and is mutually compatible with GDAL, in addition to NetCDF libraries via WSL.
Files refer to Geospatiale I/O operations that focus on GIS file conversion and operation between types. These are typically read-only, since GeoPNGs are used as the main replacement for all other files. This file format is custom and encodes 32-bit ints (with extendable support for floats) into a PNG time series, and is functionally equivalent to a GeoTIFF.
GeoPNG 32-bit int (Decode function per pixel):
global.decodeRGBAAsNumber = function (arg0_rgba) {
//Convert from parameters
var rgba = arg0_rgba;
//Declare local instance variables
var r = rgba[0];
var g = rgba[1];
var b = rgba[2];
var a = rgba[3];
//Return statement (rebuild 32-bit integer)
return ((r << 24) | (g << 16) | (b << 8) | a) >>> 0;
};
GeoPNG 32-bit int (Encode function per pixel):
function encodeNumberAsRGBA (arg0_number) {
//Convert from parameters
var number = returnSafeNumber(Math.round(arg0_number));
//Declare local instance variables
var r = (number >> 24) & 0xFF; //Extract highest 8 bits
var g = (number >> 16) & 0xFF; //Extract next 8 bits
var b = (number >> 8) & 0xFF; //Extract next 8 bits
var a = number & 0xFF; //Extract lowest 8 bits
//Return statement
return [r, g, b, a];
};
- convertASCToPNG() - Converts an .asc file to .png.
- arg0_input_file_path: (String)
- arg1_output_file_path: (String)
- arg2_options: (Object)
- is_sedac_convert_intl_dollars: (Boolean) - Optional. Whether this is SEDAC (G-Econ, Kummu et al.). If true, converts from 2011$ to 2000$.
- mode: (String) - Optional. Either ‘number’/'percentage'. ‘number’ by default.
- Returns: (Object)
- dataframe: (Array<Array<Number>>)
- max_value: (Number)
- processHYDEASCsToPNG() - Converts all HYDE .asc files to .png.
- arg0_input_folder: (String)
- arg1_output_folder: (String)
- arg2_options: (Object)
- (…) - Optional. Passed onto convertASCToPNG().
- processSEDACASCsToPNG() - Converts all SEDAC G-Econ .asc files to .png.
- arg0_input_folder: (String)
- arg1_output_folder: (String)
- arg2_options: (Object)
- (…) - Optional. Passed onto convertASCToPNG().
- readASCFile() - Reads an .asc file, returning the dataframe as a 2D array.
- arg0_file_path: (String)
- Returns: (Array<Array<Number>>)
- loadCSVAsArray() - Loads a .csv file as a 2D array.
- Returns: (Array<Array<String>>)
- geoJSONFillPolygon() - Fills a GeoJSON Polygon on a given RGBA buffer.
- arg0_rgba_buffer: (Buffer<ArrayBuffer>)
- arg1_polygon: (Object) - Must be a GeoJSON MultiPolygon/Polygon.
- arg2_options: (Object)
- height: (Number) - Optional. The height of the underlying RGBA buffer. 2160 by default (5-arcmin).
- width: (Number) - Optional. The width of the underlying RGBA buffer. 4320 by default (5-arcmin).
- Returns: (Buffer<ArrayBuffer>)
- getEquirectangularCoordsPixel() - Fetches the x, y coordinate pair for a given pixel based on latitude and longitude coordinates for WGS84 Equirectangular.
- arg0_latitude: (Number)
- arg1_longitude: (Number)
- arg2_options: (Object)
- return_object: (Boolean) - Optional. Whether to return a structured object instead. False by default.
- Returns: (Array<Number, Number>/Object):
- x_coord: (Number)
- y_coord: (Number)
- GHSLGeoJSONToRaster() - Writes a GHSL (Global Human Settlement Layer) GeoJSON file to raster. Note that this can be fetched from the web visualiser tool on Copernicus, but not academic datavaults.
- arg0_input_file_path: (String)
- arg1_output_file_path: (String)
- arg2_options: (Object)
- height: (Number) - Optional. The height of the underlying RGBA buffer. 2160 by default (5-arcmin).
- width: (Number) - Optional. The width of the underlying RGBA buffer. 4320 by default (5-arcmin).
- property: (String) - Optional. The GHSL property to target when determining colour IDs. Corresponds to urban area IDs by default ('ID_UC_G0').
- getImageSum() - Fetches the total sum of all int values within an image.
- arg0_file_path: (String) - The file path to the image to fetch the sum of.
- Returns: (Number)
- getRGBAFromPixel() - Fetches the RGBA value of a pixel based on its index.
- arg0_image_object: (Object)
- arg1_index: (Number)
- Returns: (Array<Number, Number, Number, Number>)
- loadImage() - Loads an image into the assigned value.
- arg0_file_path: (String)
- Returns: (Object)
- loadNumberFromPixel() - Loads an int value from a pixel based on its index.
- arg0_image_object: (Object)
- arg1_index: (Number)
- Returns: (Number)
- loadNumberRasterImage() - Loads a number raster image into the assigned variable.
- arg0_file_path: (String)
- Returns: (Object)
- data: (Array<Number>)
- height: (Number)
- width: (Number)
- operateNumberRasterImage() - Runs an operation on a raster image for a file.
- arg0_options: (Object)
- file_path: (String) - The file path to save the image to.
- function: (Function) - (arg0_index, arg1_number)
- arg0_index: (Number) - The linear index currently being iterated over.
- arg1_number: (Number) - The input number from the GeoPNG.
- Returns: (Number) - Optional. The new number to set for the given GeoPNG. 0 by default.
- saveNumberRatserImage() - Saves a number raster image to a file.
- arg0_options: (Object)
- file_path: (String) - The file path to save the image to.
- height: (Number) - Optional. The height of the image to save. 1 by default.
- width: (Number) - Optional. The width of the image to save. 1 by default.
- function: (Function) - (arg0_index)
- arg0_index: (Number) - The linear index currently being iterated over.
- Returns: (Number) - Optional. The new number to set for the given GeoPNG. 0 by default.
- savePercentageRasterImage() - Saves a percentage raster image to a file based on a number raster image with a step resolution of 0,5%.
- arg0_input_file_path: (String) - The file path to the number raster image to save the percentage raster image from.
- arg1_output_file_path: (String) - The file path to save the percentage raster to.
- Returns: (Object)
- saveNumberToPixel() - Saves an int value to a pixel based on the corresponding index.
- arg0_image_object: (String/Object, GeoPNG) - The image file/object to use.
- arg1_index: (Number) - The index of the pixel to save the number to.
- arg2_number: (Number) - The number to save to the pixel.
- Returns: (Array<Number, Number, Number, Number>) - RGBA code.
- convertNCToASC() - Converts a .nc file to a .asc file, depending on its options.time_index and options.variable_key.
- arg0_input_file_path: (String)
- arg1_output_file_path: (String)
- arg2_options: (Object)
- time_index: (Number) - Optional. 0 by default.
- variable_key: (String) - The variable key to write to a .asc file, as it can only store one value per .asc file.
- getNCVariables() - Fetches all variables present within a .nc file.
- arg0_input_file_path: (String)
- Returns: (Array<String>)
- processSEDAC() - Proces G-Econ SEDAC files, or Kummu-extended G-Econ SEDAC-based files.
- arg0_input_file_path: (String) - The input .nc file to convert to a series of .asc files.
- arg1_output_folder: (String)
- arg2_variable_key: (String) - The variable key to process within SEDAC data.
- convertGeoTIFFToPNG() - Attempts to convert a given GeoTIFF file to GeoPNG, assuming that it is single-band.
- arg0_input_file_path: (String)
- arg1_output_file_path: (String)
- Returns: (Object, PNG)
- downscaleGeoTIFF() - Downscales a GeoTIFF file to a given options.height, options.width resolution.
- arg0_input_file_path: (String) - The input file path.
- arg1_output_file_path: (String) - The output file path.
- arg2_options: (Object)
- height: (Number) - Optional. 2160 by default (5-arcmin).
- width: (Number) - Optional. 4320 by default (5-arcmin).
Formats are visualised web components on either a Leaflet/Maptalks Map instance. They can be plugged into Geospatiale I and converted to an end desired format. They are not the coordinates of Class instances, but the Classes themselves. Internal helper functions present in Geospatiale I are not included, as they should generally not be utilised by the end dev.
- getCoordsType() - Returns the coords format the variable represents.
- arg0_format: (Variable) - The coords format to input.
- Returns: (String) - Either 'geojson', 'leaflet', 'leaflet_non_poly', 'maptalks', 'naissance', 'naissance_history', 'turf', or 'turf_object'
- convertToGeoJSON() - Converts a visualised Object instance to GeoJSON, returning its coordinates only.
- arg0_format: (Object)
- Returns: (Array<Array<Number, Number>/Number>)
- convertToLeaflet() - Converts any format to Leaflet.
- arg0_format: (Variable) - The coords format to input.
- Returns: (Array<Array<Object>>>)
- (Object):
- lat: (Number)
- lng: (Number)
- convertToMaptalks() - Converts any format to Maptalks.
- arg0_format: (Variable) - The coords format to input.
- Returns: (Array<Array<Object>>>)
- (Object):
- x: (Number)
- y: (Number)
- z: (Number)
- convertToNaissance() - Converts any format to Naissance.
- arg0_format: (Variable) - The coords format to input.
- Returns: (Array<Array<Object>>>)
- (Object):
- lat: (Number)
- lng: (Number)
- convertToTurf() - Converts any format to Turf.
- arg0_format: (Variable) - The coords format to input.
- Returns: (Array<Array<Number, Number>>)