fmeobjects.FMERaster

Inheritance diagram of fmeobjects.FMERaster

FMERaster.appendBand(band)

Appends FMEBand to the raster.

FMERaster.boundingBox()

This method returns the bounding box of the geometry.

FMERaster.boundingCube()

This method returns the bounding cube of the geometry.

FMERaster.bounds()

Returns the bounds of the geometry.

FMERaster.clearMeasures()

Remove all measures from the geometry.

FMERaster.copyAttributesFromFeature(...)

Copies all the attributes from the given feature to traits on this geometry, if they match the (optional) regular expression.

FMERaster.copyNameFromGeometry(sourceGeometry)

Copies the name of the 'sourceGeometry' onto this geometry.

FMERaster.copyTraitsFromGeometry(...)

Copies all the traits from the given geometry that match the (optional) regular expression.

FMERaster.copyTraitsToFeature(destFeature, ...)

Copies all the traits from this geometry to attributes on the given feature, if they match the (optional) regular expression.

FMERaster.deleteName()

Deletes the geometry's name.

FMERaster.equals(raster)

Evaluates whether two rasters are identical.

FMERaster.force2D()

Reduces the geometry to 2D.

FMERaster.force3D(newZ)

This sets the geometry's dimension to 3D.

FMERaster.getArea()

Area calculation.

FMERaster.getBand(bandIndex)

Returns a band from the raster based on its numbered order in the raster.

FMERaster.getBoundingBoxAsPolygon(rotatedCorners)

Returns bounding box of the raster as FMEPolygon.

FMERaster.getMeasureNames()

Retrieve the names of the measures on this geometry.

FMERaster.getName()

This routine retrieves the 'name' of this geometry as a str.

FMERaster.getNumBands()

Returns the number of bands in a raster.

FMERaster.getProperties()

Returns Raster Properties of this raster.

FMERaster.getSourceDataset()

Returns the source dataset from which the raster was read.

FMERaster.getSourceFormatName()

Returns the short name of the source format of the raster.

FMERaster.getTrait(traitName)

Retrieves the geometry trait value of the specified trait name.

FMERaster.getTraitNames()

Retrieve the names of the traits on this geometry.

FMERaster.getTraitNullMissingAndType(traitName)

This method returns a tuple of a boolean, indicating if the trait is null, a boolean, indicating if the trait is missing, and an integer representing the type of the trait.

FMERaster.getTraitType(traitName)

Returns the type of given trait.

FMERaster.hasBeenModified()

Returns whether the raster has been modified from its baseline state.

FMERaster.hasMeasures()

Check if this geometry or any sub part of this geometry has measures.

FMERaster.hasName()

Returns whether or not the geometry has a name.

FMERaster.is3D()

Returns whether or not the geometry is 3D.

FMERaster.isCollection()

Check if the geometry is an aggregate or multi-part collection.

FMERaster.measureExists(measureName)

Returns True if the specified measure exists and False otherwise.

FMERaster.removeBand(bandIndex)

Removes and returns a band from the raster.

FMERaster.removeMeasure(measureName)

Removes the measure with name 'measureName' if supplied, or the default measure, if there is one.

FMERaster.removeTraits(regexp)

This method has 4 modes:

FMERaster.renameMeasure(oldMeasureName, ...)

Renames the measure specified by 'oldMeasureName' to the new name, specified by 'newMeasureName'.

FMERaster.setModified(modified)

Sets whether the raster has been modified from some baseline state.

FMERaster.setName(name)

Sets the geometry's name with a str.

FMERaster.setOutputSize(rows, cols)

Change the source to the size specified.

FMERaster.setTrait(traitName, traitValue)

Sets a geometry trait with the specified value.

FMERaster.setTraitNullWithType(traitName, ...)

This method supplies a null trait value with a type to the geometry.

class FMERaster

FME Raster Class

Create an instance of a FMERaster object.

init(rasterProperties)

Creates a raster with the given raster properties.

Parameters:

rasterProperties (FMERasterProperties) – Raster Properties.

Return type:

FMERaster

Returns:

An instance of a Raster object.

init(raster)

Create a copy of the passed in raster object.

Parameters:

raster (FMERaster) – The raster object to create a copy of.

Return type:

FMERaster

Returns:

An instance of a FMERaster object.

__init__(*args, **kwargs)
appendBand(band)

Appends FMEBand to the raster.

Parameters:

band (FMEBand) – Band to append.

Return type:

None

Raises:

FMEException – An exception is raised if an error occurred.

boundingBox()

This method returns the bounding box of the geometry.

Return type:

tuple[tuple[float]]

Returns:

The bounding box of the Geometry, in the form ((minx, miny), (maxx, maxy)).

boundingCube()

This method returns the bounding cube of the geometry.

Return type:

tuple[tuple[float]]

Returns:

The bounding box of the Geometry, in the form ((minx, miny, minz), (maxx, maxy, maxz)).

bounds()

Returns the bounds of the geometry.

Return type:

tuple[FMEPoint]

Returns:

The min point and max point of the bounds. None is returned if the geometry contains no points.

clearMeasures()

Remove all measures from the geometry.

Return type:

None

copyAttributesFromFeature(sourceFeature, overwriteExisting, regexp, prefix)

Copies all the attributes from the given feature to traits on this geometry, if they match the (optional) regular expression.

Parameters:
  • sourceFeature (FMEFeature) – The feature to copy attributes from.

  • overwriteExisting (bool) – Existing traits will be overwritten only if overwriteExisting is True.

  • regexp (str) – (Optional) The regular expression to match the attributes against. If regexp is not specified, then all attributes will be copied.

  • prefix (str) – (Optional) The prefix is put on all the trait names as they are copied. If it is not specified, a prefix will not be added to the trait names.

Return type:

None

copyNameFromGeometry(sourceGeometry)

Copies the name of the ‘sourceGeometry’ onto this geometry. If ‘sourceGeometry’s name is blank or None, this geometry’s name will become None.

Parameters:

sourceGeometry (FMEGeometry) – The geometry to copy the name from.

Return type:

None

copyTraitsFromGeometry(sourceGeometry, overwriteExisting, regexp, prefix)

Copies all the traits from the given geometry that match the (optional) regular expression.

Parameters:
  • sourceGeometry (FMEGeometry) – The geometry to copy traits from.

  • overwriteExisting (bool) – Existing traits will be overwritten only if overwriteExisting is True.

  • regexp (str) – (Optional) The regular expression to match the traits against. If regexp is not specified, or is an empty string, then all traits will be copied.

  • prefix (str) – (Optional) The prefix is put on all the trait names as they are copied. If it is not specified, a prefix will not be added to the trait names.

Return type:

None

copyTraitsToFeature(destFeature, overwriteExisting, regexp, prefix)

Copies all the traits from this geometry to attributes on the given feature, if they match the (optional) regular expression.

Parameters:
  • destFeature (FMEFeature) – The feature to copy traits to.

  • overwriteExisting (bool) – Existing attributes will be overwritten only if overwriteExisting is True.

  • regexp (str) – (Optional) The regular expression to match the traits against. If regexp is not specified, or is an empty string, then all traits will be copied.

  • prefix (str) – (Optional) The prefix is put on all the attribute names as they are copied. If it is not specified, a prefix will not be added to the attribute names.

Return type:

None

deleteName()

Deletes the geometry’s name. If a name existed prior to this call then True is returned; otherwise False is returned.

Return type:

bool

Returns:

Returns a boolean indicating whether or not the name existed before deletion.

equals(raster)

Evaluates whether two rasters are identical.

Parameters:

raster (FMERaster) – The raster object to compare to.

Return type:

bool

Returns:

True if the two rasters are the same.

force2D()

Reduces the geometry to 2D.

Return type:

None

force3D(newZ)

This sets the geometry’s dimension to 3D. All Z values are set to the value passed in, even if the geometry is already 3D.

Parameters:

newZ (float) – The new Z value.

Return type:

None

getArea()

Area calculation.

Return type:

float

Returns:

The calculated area.

getBand(bandIndex)

Returns a band from the raster based on its numbered order in the raster.

Parameters:

bandIndex (int) – Index number of the band.

Return type:

FMEBand

Returns:

A band from the raster.

Raises:

FMEException – An exception is raised if an error occurred.

getBoundingBoxAsPolygon(rotatedCorners)

Returns bounding box of the raster as FMEPolygon.

Parameters:

rotatedCorners (bool) – Specifies whether the rotated corners of the raster should be used in the bounding box.

Return type:

FMEPolygon

Returns:

Bounding box of the raster.

Raises:

FMEException – An exception is raised if an error occurred.

getMeasureNames()

Retrieve the names of the measures on this geometry.

Return type:

tuple[str]

Returns:

Return a tuple storing the names of the measures on this geometry. This will return an empty tuple if there are no measures. For FMEAggregate, FMEMultiSurface, and FMECompositeSurface, this will return the union of all measure names of all of its parts.

getName()

This routine retrieves the ‘name’ of this geometry as a str. This will return None if it did not have a name associated with it.

Return type:

str or None

Returns:

The geometry’s name.

getNumBands()

Returns the number of bands in a raster.

Return type:

int

Returns:

Number of bands in a raster.

getProperties()

Returns Raster Properties of this raster.

Return type:

FMERasterProperties

Returns:

Raster Properties of this raster.

Raises:

FMEException – An exception is raised if an error occurred.

getSourceDataset()

Returns the source dataset from which the raster was read.

Return type:

str

Returns:

Source dataset from which the raster was read.

getSourceFormatName()

Returns the short name of the source format of the raster.

Return type:

str

Returns:

Short name of the source format of the raster.

getTrait(traitName)

Retrieves the geometry trait value of the specified trait name. Null trait values will be returned as an empty string. Binary blob traits are returned as a bytearray.

None is returned when the trait is not found on the geometry.

Parameters:

traitName (str) – The name of the geometry trait.

Return type:

bool, int, float, str, bytearray, bytes or None

Returns:

The trait value.

Raises:

FMEException – An exception is raised if there was a problem in retrieving the trait value.

getTraitNames()

Retrieve the names of the traits on this geometry.

Return type:

tuple[str]

Returns:

Return a tuple storing the names of the traits on this geometry. This will return an empty tuple if there are no traits. For all collections and containers, this will only return the names of traits on the outermost object only.

getTraitNullMissingAndType(traitName)

This method returns a tuple of a boolean, indicating if the trait is null, a boolean, indicating if the trait is missing, and an integer representing the type of the trait. The first boolean is True if ‘traitName’ maps to a null trait value on the geometry. Otherwise it is False. The second boolean is True if ‘traitName’ maps to a no value on the geometry. Otherwise it is False. If the trait is absent, FME_ATTR_UNDEFINED is returned for the type.

The possible trait types are FME_ATTR_UNDEFINED, FME_ATTR_BOOLEAN, FME_ATTR_INT8, FME_ATTR_UINT8, FME_ATTR_INT16, FME_ATTR_UINT16, FME_ATTR_INT32, FME_ATTR_UINT32, FME_ATTR_REAL32, FME_ATTR_REAL64, FME_ATTR_REAL80, FME_ATTR_STRING, FME_ATTR_ENCODED_STRING, FME_ATTR_INT64, FME_ATTR_UINT64.

Parameters:

traitName (str) – The trait’s name.

Return type:

tuple[bool, bool, int]

Returns:

A tuple of 2 boolean values the first indicating whether or not the value of the trait is null, the second indicating whether or not the trait is missing, and an integer representing the trait type.

getTraitType(traitName)

Returns the type of given trait. If the trait cannot be found, FME_ATTR_UNDEFINED will be returned.

Returns one of FME_ATTR_UNDEFINED, FME_ATTR_BOOLEAN, FME_ATTR_INT8, FME_ATTR_UINT8, FME_ATTR_INT16, FME_ATTR_UINT16, FME_ATTR_INT32, FME_ATTR_UINT32, FME_ATTR_REAL32, FME_ATTR_REAL64, FME_ATTR_REAL80, FME_ATTR_STRING, FME_ATTR_ENCODED_STRING, FME_ATTR_INT64, FME_ATTR_UINT64.

Parameters:

traitName (str) – The trait’s name.

Return type:

int

Returns:

The trait type.

hasBeenModified()

Returns whether the raster has been modified from its baseline state.

Return type:

bool

Returns:

True if raster has been modified, False if it hasn’t.

hasMeasures()

Check if this geometry or any sub part of this geometry has measures.

Return type:

bool

Returns:

True if this geometry or any sub part of this geometry has measures, False otherwise.

hasName()

Returns whether or not the geometry has a name.

Return type:

bool

Returns:

Returns True if the geometry has a name and False otherwise.

is3D()

Returns whether or not the geometry is 3D.

Return type:

bool

Returns:

Returns True if the geometry is 3D and False otherwise. For FMENull, this method will always return True. For FMEAggregate, FMEMultiPoint, FMEMultiArea, FMEMultiText and FMEMultiCurve, this method will return True if any one of the sub-parts is 3D. If the collection is empty or all of its members are 2D, this method will return False.

isCollection()

Check if the geometry is an aggregate or multi-part collection.

Return type:

bool

Returns:

True if the geometry is an aggregate or multi-part collection.

measureExists(measureName)

Returns True if the specified measure exists and False otherwise. If the ‘measureName’ parameter is not specified then the default measure is checked.

Parameters:

measureName (str) – (Optional) The measure’s name.

Return type:

bool

Returns:

Boolean indicating whether or not the measure exists.

removeBand(bandIndex)

Removes and returns a band from the raster.

Parameters:

bandIndex (int) – Index number of the band.

Return type:

FMEBand

Returns:

Removed band.

Raises:

FMEException – An exception is raised if an error occurred.

removeMeasure(measureName)

Removes the measure with name ‘measureName’ if supplied, or the default measure, if there is one.

Parameters:

measureName (str) – (Optional) The name of the measure to remove.

Return type:

None

removeTraits(regexp)

This method has 4 modes:

  1. Remove all traits at the top level: regex == NULL

  2. Remove some traits at the top level: regex == <string>

  3. Remove all traits at all levels: regex == kFME_RecurseAll

  4. Remove some traits at all levels: regex == kFME_RecurseSome <string>

For example, specifying regex == NULL for a multi-surface will remove all traits at the root level of the multi-surface, whereas specifying regex == kFME_RecurseSome <string> will remove all traits from all levels of the multi surface that match <string>. If <string> is an illegal regular expression, no traits will be removed.

Return type:

None

renameMeasure(oldMeasureName, newMeasureName)

Renames the measure specified by ‘oldMeasureName’ to the new name, specified by ‘newMeasureName’.

Parameters:
  • oldMeasureName (str) – The original name of the measure.

  • newMeasureName (str) – The new name of the measure.

Return type:

None

setModified(modified)

Sets whether the raster has been modified from some baseline state. This will initially be set to False for rasters generated by readers. Then, any calls that alter the raster will cause the modified state to become True (this does not need to be explicitly set; it will occur automatically).

Parameters:

modified (bool) – Specifies whether the raster has been modified from the baseline state.

Return type:

None

setName(name)

Sets the geometry’s name with a str. By supplying a blank name as input, this method will act as deleteName().

Parameters:

name (str) – The geometry’s new name.

Return type:

None

setOutputSize(rows, cols)

Change the source to the size specified.

Parameters:
  • rows (int) – Number of rows.

  • cols (int) – Number of columns.

Return type:

tuple[int]

Returns:

New number of rows and columns after resampling the raster.

Raises:

FMEException – An exception is raised if an error occurred.

setTrait(traitName, traitValue)

Sets a geometry trait with the specified value. If the geometry trait already exists, its value and type will be changed. The following type numeric mappings are used:

PyInt ==> FME_Int32

PyFloat ==> FME_Real64

PyLong ==> FME_Int64

Binary values are to be specified as bytearray values or bytes values.

Parameters:
Return type:

None

setTraitNullWithType(traitName, traitType)

This method supplies a null trait value with a type to the geometry. If a trait with the same name already exists, it is overwritten.

Trait type must be one of FME_ATTR_UNDEFINED, FME_ATTR_BOOLEAN, FME_ATTR_INT8, FME_ATTR_UINT8, FME_ATTR_INT16, FME_ATTR_UINT16, FME_ATTR_INT32, FME_ATTR_UINT32, FME_ATTR_REAL32, FME_ATTR_REAL64, FME_ATTR_REAL80, FME_ATTR_STRING, FME_ATTR_ENCODED_STRING, FME_ATTR_INT64, FME_ATTR_UINT64.

Parameters:
  • traitName (str) – The trait’s name.

  • traitType (int) – An integer representing the trait type.

Return type:

None