Skip to content

A set of functions for working with the pixel data type.


DefaultValue

DefaultValue(inputPixel, key, defaultValue) -> Any

Since version 1.35

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 null or an empty text value.

Return value: Any
Returns the value for the specified field if defined. Otherwise, returns the value specified in defaultValue.

Example

Return "No data" if pixel attribute does not exist or is empty

Use dark colors for code blocksCopy
1
2
3
DefaultValue($pixel, "Raster.sea_temp", "No data")
// Returns the sea_temp value if available
// or 'No data' if not available

HasKey

HasKey(inputPixel, key) -> Boolean

Since version 1.35

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

Use dark colors for code blocksCopy
1
HasKey($pixel, 'elev');

HasValue

HasValue(inputPixel, key) -> Boolean

Since version 1.35

Function bundle: Core

Indicates whether a pixel has a given attribute and if that attribute has a value.

Parameters

  • inputPixel: Pixel - The pixel to check.
  • key: Text - The attribute name to check for a value.

Return value: Boolean

Additional resources

Example

Return false if pixel attribute does not exist or is empty

Use dark colors for code blocksCopy
1
2
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

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.