A set of functions for working with the pixel data type.
DefaultValue
DefaultValue(inputPixel, key, defaultValue) -> Any
Function bundle: Core
Returns a specified default value if a field name in a given pixel does not exist or the value of the specified field is null or an empty text value.
Parameters
- inputPixel: Pixel - The input pixel to check.
- key: Text - The field name to check for a value.
- defaultValue: Any - This value is returned if the field name does not exist or the value of the specified field is
nullor an empty text value.
Return value: Any
Returns the value for the specified field if defined. Otherwise, returns the value specified in default.
Example
Return "No data" if pixel attribute does not exist or is empty
DefaultValue($pixel, "Raster.sea_temp", "No data")
// Returns the sea_temp value if available
// or 'No data' if not availableHasKey
HasKey(inputPixel, key) -> Boolean
Function bundle: Core
Indicates whether a pixel contains the given key or attribute.
Parameters
- inputPixel: Pixel - The pixel to check for an attribute name.
- key: Text - The attribute name to check.
Return value: Boolean
Example
Returns true if the pixel has an attribute named elev
HasKey($pixel, 'elev');HasValue
HasValue(inputPixel, key) -> Boolean
Function bundle: Core
Indicates whether a pixel has a given attribute and if that attribute has a value.
Parameters
Return value: Boolean
Additional resources
Example
Return false if pixel attribute does not exist or is empty
iif(HasValue($pixel, "Raster.ServicePixelValue"), ($pixel["Raster.ServicePixelValue"][0] - 32) * 5/9, "No Data")
// Returns the temp in celsius if the Raster.ServicePixelValue is available