workflow_builder.operators
This module contains helpers to create workflow operators for the Geo Engine API.
Operator Objects
Section titled “Operator Objects”class Operator()Base class for all operators.
@abstractmethoddef name() -> strReturns the name of the operator.
to_dict
Section titled “to_dict”@abstractmethoddef to_dict() -> dict[str, Any]Returns a dictionary representation of the operator that can be used to create a JSON request for the API.
data_type
Section titled “data_type”@abstractmethoddef data_type() -> Literal["Raster", "Vector"]Returns the type of the operator.
to_workflow_dict
Section titled “to_workflow_dict”def to_workflow_dict() -> dict[str, Any]Returns a dictionary representation of a workflow that calls the operator” “that can be used to create a JSON request for the workflow API.
from_workflow_dict
Section titled “from_workflow_dict”@classmethoddef from_workflow_dict(cls, workflow) -> OperatorReturns an operator from a workflow dictionary.
RasterOperator Objects
Section titled “RasterOperator Objects”class RasterOperator(Operator)Base class for all raster operators.
from_operator_dict
Section titled “from_operator_dict”@classmethoddef from_operator_dict(cls, operator_dict: dict[str, Any]) -> RasterOperatorReturns an operator from a dictionary.
VectorOperator Objects
Section titled “VectorOperator Objects”class VectorOperator(Operator)Base class for all vector operators.
from_operator_dict
Section titled “from_operator_dict”@classmethoddef from_operator_dict(cls, operator_dict: dict[str, Any]) -> VectorOperatorReturns an operator from a dictionary.
GdalSource Objects
Section titled “GdalSource Objects”class GdalSource(RasterOperator)A GDAL source operator.
__init__
Section titled “__init__”def __init__(dataset: str | DatasetName)Creates a new GDAL source operator.
from_operator_dict
Section titled “from_operator_dict”@classmethoddef from_operator_dict(cls, operator_dict: dict[str, Any]) -> GdalSourceReturns an operator from a dictionary.
OgrSource Objects
Section titled “OgrSource Objects”class OgrSource(VectorOperator)An OGR source operator.
__init__
Section titled “__init__”def __init__(dataset: str | DatasetName, attribute_projection: str | None = None, attribute_filters: str | None = None)Creates a new OGR source operator.
from_operator_dict
Section titled “from_operator_dict”@classmethoddef from_operator_dict(cls, operator_dict: dict[str, Any]) -> OgrSourceReturns an operator from a dictionary.
Interpolation Objects
Section titled “Interpolation Objects”class Interpolation(RasterOperator)An interpolation operator.
__init__
Section titled “__init__”def __init__(source_operator: RasterOperator, output_x: float, output_y: float, output_method: Literal["resolution", "fraction"] = "resolution", interpolation: Literal["biLinear", "nearestNeighbor"] = "biLinear")Creates a new interpolation operator.
from_operator_dict
Section titled “from_operator_dict”@classmethoddef from_operator_dict(cls, operator_dict: dict[str, Any]) -> InterpolationReturns an operator from a dictionary.
Downsampling Objects
Section titled “Downsampling Objects”class Downsampling(RasterOperator)A Downsampling operator.
__init__
Section titled “__init__”def __init__(source_operator: RasterOperator, output_x: float, output_y: float, output_method: Literal["resolution", "fraction"] = "resolution", sample_method: Literal["nearestNeighbor"] = "nearestNeighbor")Creates a new Downsampling operator.
from_operator_dict
Section titled “from_operator_dict”@classmethoddef from_operator_dict(cls, operator_dict: dict[str, Any]) -> DownsamplingReturns an operator from a dictionary.
ColumnNames Objects
Section titled “ColumnNames Objects”class ColumnNames()Base class for deriving column names from bands of a raster.
from_dict
Section titled “from_dict”@classmethoddef from_dict(cls, rename_dict: dict[str, Any]) -> ColumnNamesReturns a ColumnNames object from a dictionary.
ColumnNamesDefault Objects
Section titled “ColumnNamesDefault Objects”class ColumnNamesDefault(ColumnNames)column names with default suffix.
ColumnNamesSuffix Objects
Section titled “ColumnNamesSuffix Objects”class ColumnNamesSuffix(ColumnNames)Rename bands with custom suffixes.
ColumnNamesNames Objects
Section titled “ColumnNamesNames Objects”class ColumnNamesNames(ColumnNames)Rename bands with new names.
RasterVectorJoin Objects
Section titled “RasterVectorJoin Objects”class RasterVectorJoin(VectorOperator)A RasterVectorJoin operator.
__init__
Section titled “__init__”def __init__(raster_sources: list[RasterOperator], vector_source: VectorOperator, names: ColumnNames, temporal_aggregation: Literal["none", "first", "mean"] = "none", temporal_aggregation_ignore_nodata: bool = False, feature_aggregation: Literal["first", "mean"] = "mean", feature_aggregation_ignore_nodata: bool = False)Creates a new RasterVectorJoin operator.
from_operator_dict
Section titled “from_operator_dict”@classmethoddef from_operator_dict(cls, operator_dict: dict[str, Any]) -> RasterVectorJoinReturns an operator from a dictionary.
PointInPolygonFilter Objects
Section titled “PointInPolygonFilter Objects”class PointInPolygonFilter(VectorOperator)A PointInPolygonFilter operator.
__init__
Section titled “__init__”def __init__(point_source: VectorOperator, polygon_source: VectorOperator)Creates a new PointInPolygonFilter filter operator.
from_operator_dict
Section titled “from_operator_dict”@classmethoddef from_operator_dict(cls, operator_dict: dict[str, Any]) -> PointInPolygonFilterReturns an operator from a dictionary.
RasterScaling Objects
Section titled “RasterScaling Objects”class RasterScaling(RasterOperator)A RasterScaling operator.
This operator scales the values of a raster by a given slope and offset.
The scaling is done as follows: y = (x - offset) / slope
The unscale mode is the inverse of the scale mode: x = y * slope + offset
__init__
Section titled “__init__”def __init__(source: RasterOperator, slope: float | str | None = None, offset: float | str | None = None, scaling_mode: Literal["mulSlopeAddOffset", "subOffsetDivSlope"] = "mulSlopeAddOffset", output_measurement: str | None = None)Creates a new RasterScaling operator.
RasterTypeConversion Objects
Section titled “RasterTypeConversion Objects”class RasterTypeConversion(RasterOperator)A RasterTypeConversion operator.
__init__
Section titled “__init__”def __init__(source: RasterOperator, output_data_type: Literal["U8", "U16", "U32", "U64", "I8", "I16", "I32", "I64", "F32", "F64"])Creates a new RasterTypeConversion operator.
Reprojection Objects
Section titled “Reprojection Objects”class Reprojection(Operator)A Reprojection operator.
__init__
Section titled “__init__”def __init__(source: Operator, target_spatial_reference: str)Creates a new Reprojection operator.
as_vector
Section titled “as_vector”def as_vector() -> VectorOperatorCasts this operator to a VectorOperator.
as_raster
Section titled “as_raster”def as_raster() -> RasterOperatorCasts this operator to a RasterOperator.
from_operator_dict
Section titled “from_operator_dict”@classmethoddef from_operator_dict(cls, operator_dict: dict[str, Any]) -> ReprojectionConstructs the operator from the given dictionary.
Expression Objects
Section titled “Expression Objects”class Expression(RasterOperator)An Expression operator.
__init__
Section titled “__init__”def __init__(expression: str, source: RasterOperator, output_type: Literal["U8", "U16", "U32", "U64", "I8", "I16", "I32", "I64", "F32", "F64"] = "F32", map_no_data: bool = False, output_band: RasterBandDescriptor | None = None)Creates a new Expression operator.
BandwiseExpression Objects
Section titled “BandwiseExpression Objects”class BandwiseExpression(RasterOperator)A bandwise Expression operator.
__init__
Section titled “__init__”def __init__(expression: str, source: RasterOperator, output_type: Literal["U8", "U16", "U32", "U64", "I8", "I16", "I32", "I64", "F32", "F64"] = "F32", map_no_data: bool = False)Creates a new Expression operator.
GeoVectorDataType Objects
Section titled “GeoVectorDataType Objects”class GeoVectorDataType(Enum)The output type of geometry vector data.
VectorExpression Objects
Section titled “VectorExpression Objects”class VectorExpression(VectorOperator)The VectorExpression operator.
__init__
Section titled “__init__”def __init__(source: VectorOperator, *, expression: str, input_columns: list[str], output_column: str | GeoVectorDataType, geometry_column_name: str | None = None, output_measurement: Measurement | None = None)Creates a new VectorExpression operator.
TemporalRasterAggregation Objects
Section titled “TemporalRasterAggregation Objects”class TemporalRasterAggregation(RasterOperator)A TemporalRasterAggregation operator.
__init__
Section titled “__init__”def __init__(source: RasterOperator, aggregation_type: Literal["mean", "min", "max", "median", "count", "sum", "first", "last", "percentileEstimate"], ignore_no_data: bool = False, granularity: Literal["days", "months", "years", "hours", "minutes", "seconds", "millis"] = "days", window_size: int = 1, output_type: Literal["U8", "U16", "U32", "U64", "I8", "I16", "I32", "I64", "F32", "F64"] | None = None, percentile: float | None = None, window_reference: datetime.datetime | np.datetime64 | None = None)Creates a new TemporalRasterAggregation operator.
TimeShift Objects
Section titled “TimeShift Objects”class TimeShift(Operator)A RasterTypeConversion operator.
__init__
Section titled “__init__”def __init__(source: RasterOperator | VectorOperator, shift_type: Literal["relative", "absolute"], granularity: Literal["days", "months", "years", "hours", "minutes", "seconds", "millis"], value: int)Creates a new RasterTypeConversion operator.
as_vector
Section titled “as_vector”def as_vector() -> VectorOperatorCasts this operator to a VectorOperator.
as_raster
Section titled “as_raster”def as_raster() -> RasterOperatorCasts this operator to a RasterOperator.
from_operator_dict
Section titled “from_operator_dict”@classmethoddef from_operator_dict(cls, operator_dict: dict[str, Any]) -> TimeShiftConstructs the operator from the given dictionary.
RenameBands Objects
Section titled “RenameBands Objects”class RenameBands()Base class for renaming bands of a raster.
from_dict
Section titled “from_dict”@classmethoddef from_dict(cls, rename_dict: dict[str, Any]) -> RenameBandsReturns a RenameBands object from a dictionary.
RenameBandsDefault Objects
Section titled “RenameBandsDefault Objects”class RenameBandsDefault(RenameBands)Rename bands with default suffix.
RenameBandsSuffix Objects
Section titled “RenameBandsSuffix Objects”class RenameBandsSuffix(RenameBands)Rename bands with custom suffixes.
RenameBandsRename Objects
Section titled “RenameBandsRename Objects”class RenameBandsRename(RenameBands)Rename bands with new names.
RasterStacker Objects
Section titled “RasterStacker Objects”class RasterStacker(RasterOperator)The RasterStacker operator.
__init__
Section titled “__init__”def __init__(sources: list[RasterOperator], rename: RenameBands | None = None)Creates a new RasterStacker operator.
BandNeighborhoodAggregate Objects
Section titled “BandNeighborhoodAggregate Objects”class BandNeighborhoodAggregate(RasterOperator)The BandNeighborhoodAggregate operator.
__init__
Section titled “__init__”def __init__(source: RasterOperator, aggregate: BandNeighborhoodAggregateParams)Creates a new BandNeighborhoodAggregate operator.
BandNeighborhoodAggregateParams Objects
Section titled “BandNeighborhoodAggregateParams Objects”class BandNeighborhoodAggregateParams()Abstract base class for band neighborhood aggregate params.
from_dict
Section titled “from_dict”@classmethoddef from_dict( cls, band_neighborhood_aggregate_dict: dict[str, Any]) -> BandNeighborhoodAggregateParamsReturns a BandNeighborhoodAggregate object from a dictionary.
BandNeighborhoodAggregateFirstDerivative Objects
Section titled “BandNeighborhoodAggregateFirstDerivative Objects”@dataclassclass BandNeighborhoodAggregateFirstDerivative(BandNeighborhoodAggregateParams )The first derivative band neighborhood aggregate.
BandNeighborhoodAggregateAverage Objects
Section titled “BandNeighborhoodAggregateAverage Objects”@dataclassclass BandNeighborhoodAggregateAverage(BandNeighborhoodAggregateParams)The average band neighborhood aggregate.
Onnx Objects
Section titled “Onnx Objects”class Onnx(RasterOperator)Onnx ML operator.
__init__
Section titled “__init__”def __init__(source: RasterOperator, model: str)Creates a new Onnx operator.