fmeobjects.FMEFeature

Inheritance diagram of fmeobjects.FMEFeature

FMEFeature.addCoordinate(x, y[, z])

If the feature is two-dimensional, any provided third coordinate is ignored.

FMEFeature.addCoordinates(coordinates)

Adds coordinates onto the feature.

FMEFeature.boundingBox()

This method returns the bounding box of the feature.

FMEFeature.boundingCube()

This method returns the bounding cube of the feature.

FMEFeature.buffer(width, sampleAngle)

This method generates a buffer around the feature.

FMEFeature.buildAggregateFeat(featureList)

Create an aggregate feature from the supplied list of features.

FMEFeature.changeCase(changeOpt, matchExp, ...)

Change the letter case of attribute names and values.

FMEFeature.chopUp(vertexThreshold)

Convert a feature into an aggregate where each member of the aggregate has fewer than the threshold number of vertices.

FMEFeature.clone()

Create a new FMEFeature as a clone of this one.

FMEFeature.cloneAttributes()

Create a new FMEFeature with only the attributes of this one copied over.

FMEFeature.convertAnyArcToPoints(center, ...)

Strokes an arc feature to be a polygon or line.

FMEFeature.convertArcToPointUseAttributes()

Return the bounding cube of the feature in the format ((min x, min y, min z), (max x, max y, max z)) Strokes an arc feature to be a polygon or line.

FMEFeature.convertArcToPoints(center, ...)

Strokes an arc feature to be a polygon or line.

FMEFeature.convertPointsToArc(...)

Converts the feature into a point feature with attributes required to define it as an arc.

FMEFeature.deserialize(buffer, parameters)

Restore the state of the FMEFeature from the specified buffer.

FMEFeature.exportGeometryToOGCWKB(version)

Convert the geometry of the feature to the OGC Well Known Binary format.

FMEFeature.exportGeometryToOGCWKT(version)

Convert the geometry of the feature to the OGC Well Known Text format.

FMEFeature.generatePointInPolygon(pretty)

Generate a point somewhere inside the polygon.

FMEFeature.getAllAttributeNames()

This method returns a complete, exhaustive list of all the attribute names present in the feature.

FMEFeature.getAllCoordinates()

Get all the coordinates in this feature.

FMEFeature.getAttribute(attrName, ...)

Get the value of the named attribute.

FMEFeature.getAttributeAsType(attrName, ...)

This method is deprecated as of FME 2021.0.

FMEFeature.getAttributeNullMissingAndType(...)

This method is deprecated as of FME 2021.0.

FMEFeature.getAttributeType(attrName)

Get the type of the named attribute.

FMEFeature.getCoordSys()

Get the Coordinate System of the feature.

FMEFeature.getCoordinate(index)

Access the feature's individual coordinates by index.

FMEFeature.getDimension()

Get the dimension of the feature.

FMEFeature.getDonutParts()

Break a donut feature into its constituent parts.

FMEFeature.getFeatureType()

Get the Feature Type of the feature.

FMEFeature.getGeometry()

Get the feature's geometry.

FMEFeature.getGeometryType()

Get the feature's classic geometry type.

FMEFeature.getSequencedAttributeNames()

This method gets a list of sequenced attribute names in the order they were added to the feature.

FMEFeature.hasGeometry()

This method is deprecated as of FME 2022.1.

FMEFeature.hasRichGeometry()

This method is deprecated as of FME 2021.0.

FMEFeature.importGeometryFromOGCWKB(ogcwkb)

Set the geometry of the feature to be that specified in the OGC Well Known Binary format.

FMEFeature.importGeometryFromOGCWKT(ogcwkt)

Set the geometry of the feature to be that specified in the OGC Well Known Text format.

FMEFeature.interpolateSpline(...)

Perform interpolation on the feature.

FMEFeature.isAttributeMissing(attributeName)

This method returns a boolean indicating if the attribute name maps to no value on the feature.

FMEFeature.isAttributeNull(attributeName)

This method returns a boolean indicating if the attribute name maps to a null attribute value on the feature.

FMEFeature.makeDonuts(featureList)

Construct a donut polygon from the list of features provided.

FMEFeature.matrixTransform(matrix)

Perform a 2D or 3D matrix transformation on the feature.

FMEFeature.mergeAttributes(destFeature)

Set the featureType and attributes of the feature passed in from the current feature, but ONLY if those attributes are not already present.

FMEFeature.numCoords()

Get the number of coordinates in the feature.

FMEFeature.numParts(flatten, splitDonuts)

Get the number of parts that make up the geometry of the feature.

FMEFeature.numVertices()

Get the number of vertices that make up the geometry of the feature Multi-part (aggregate) geometries are handled properly.

FMEFeature.offset(x, y, z)

Offsets the feature by the given amounts.

FMEFeature.orient(rule)

Optionally set and get the orientation rule of the feature.

FMEFeature.outerShell()

Set the geometry of the feature to be just its outer shell.

FMEFeature.performFunction(functionSpecification)

Call an FME function on the feature.

FMEFeature.processFeatures(featureList, ...)

Perform some general processing operation on a list of features.

FMEFeature.removeAttribute(attrName)

Remove the named attribute if it exists.

FMEFeature.removeAttrsWithPrefix(attrPrefix)

Remove the named attribute if it exists.

FMEFeature.removeGeometry()

Remove and return the feature's geometry.

FMEFeature.removeTraits(regexp)

Remove all or matching traits from the feature.

FMEFeature.reproject(coordSys)

Reproject the feature from its current coordinate system to that specified.

FMEFeature.resetCoords()

Reset the number of coordinates in the feature to 0.

FMEFeature.resetFeature()

Reset (clear) all the attributes and geometry of the feature.

FMEFeature.rotate2D(origin, angle)

Rotate the feature counterclockwise around the origin point by the specified angle (in degrees).

FMEFeature.scale(x, y, z)

Scale the feature by the given amounts.

FMEFeature.serialize(parameters)

Write the state of the FMEFeature to a string buffer.

FMEFeature.setAttribute(attrName, attrValue)

Supply a new attribute for the feature.

FMEFeature.setAttributeNullWithType(...)

This method supplies a null attribute with a type to the feature.

FMEFeature.setCoordSys(coordSys)

Set the Coordinate System of the feature.

FMEFeature.setDimension(dimension)

Dimension must either be FME_TWO_D or FME_THREE_D

FMEFeature.setFeatureType(featureType)

This method sets the feature type of the FMEFeature.

FMEFeature.setGeometry(geometry)

Set the feature's geometry.

FMEFeature.setGeometryType(geomType)

Set the feature's classic geometry type.

FMEFeature.setSequencedAttribute(attrName, ...)

Supply a new attribute for the feature, but in such a way that the sequence is remembered.

FMEFeature.splitAggregate(recurse)

Split up an aggregate feature into pieces, all of which have the same attributes and feature type.

class FMEFeature

FME Feature class

Create an instance of a feature which is used throughout the system to contain both geometric and attribute data.

init()

Default FMEFeature constructor.

Return type:

FMEFeature

Returns:

An instance of a Feature object.

init(feature)

Create a copy of the passed in Feature object.

Parameters:

feature (FMEFeature) – The Feature object to create a copy of.

Return type:

FMEFeature

Returns:

An instance of a Feature object.

__init__(*args, **kwargs)
addCoordinate(x, y, z=0.0)

If the feature is two-dimensional, any provided third coordinate is ignored.

Parameters:
  • x (float) – The x coordinate to add.

  • y (float) – The y coordinate to add.

  • z (float) – (Optional) The z coordinate to add. (Default value is 0.0)

Return type:

None

addCoordinates(coordinates)

Adds coordinates onto the feature. Missing values are replaced by 0.

If the feature is two-dimensional, any provided third coordinate is ignored.

Parameters:

coordinates (list[tuple[float]]) – The list of coordinates to add.

Return type:

None

boundingBox()

This method returns the bounding box of the feature.

Return type:

tuple[tuple[float]]

Returns:

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

Raises:

FMEException – An exception is raised if an error occurred.

boundingCube()

This method returns the bounding cube of the feature.

Return type:

tuple[tuple[float]]

Returns:

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

Raises:

FMEException – An exception is raised if an error occurred.

buffer(width, sampleAngle)

This method generates a buffer around the feature. The features geometry is replaced by the new buffer geometry. If the feature is an area feature then the buffer is only generated on the outside (and inside holes) of the feature.

Parameters:
  • width (float) – The number of ground units to buffer around the feature.

  • sampleAngle (float) – The sampling angle. If 5 then there is a vertex on the buffer every 5 degrees.

Return type:

None

Raises:

FMEException – An exception is raised if an error occurred.

buildAggregateFeat(featureList)

Create an aggregate feature from the supplied list of features.

Parameters:

featureList (list[FMEFeature]) – The list of features to build the aggregate from.

Return type:

None

Raises:

FMEException – An exception is raised if an error occurred.

changeCase(changeOpt, matchExp, caseType)

Change the letter case of attribute names and values.

Parameters:
  • changeOpt (int) –

    Must be one of:

  • matchExp (str or list) – Can either be a regular expression, or a list of attribute names to change.

  • caseType (int) – The new case to change the letters of the attribute names and values to.

Must be one of:

Return type:

None

Raises:

FMEException – An exception is raised if an error occurred.

chopUp(vertexThreshold)

Convert a feature into an aggregate where each member of the aggregate has fewer than the threshold number of vertices.

If the feature was an area based feature, it will do area chopping, subdividing the area so that no area piece has more than the number of vertices.

If the feature was linear, then the line is broken into chunks that meet the size criteria.

Parameters:

vertexThreshold (int) – The threshold number of vertices.

Return type:

bool

Returns:

True if the feature was chopped, False otherwise.

Raises:

FMEException – An exception is raised if an error occurred.

clone()

Create a new FMEFeature as a clone of this one.

Return type:

FMEFeature

Returns:

A clone of the original feature.

Raises:

FMEException – An exception is raised if an error occurred.

cloneAttributes()

Create a new FMEFeature with only the attributes of this one copied over.

Return type:

FMEFeature

Returns:

A new FMEFeature with the same attributes as the original.

Raises:

FMEException – An exception is raised if an error occurred.

convertAnyArcToPoints(center, semiPrimaryAxis, semiSecondaryAxis, origNumSamps, startAngle, sweepAngle, rotation)

Strokes an arc feature to be a polygon or line.

Parameters:
  • center ((float, float)) – The center coordinate.

  • semiPrimaryAxis (float) – The semi-primary axis.

  • semiSecondaryAxis (float) – The semi-secondary axis.

  • origNumSamps (int) – The original number of samples.

  • startAngle (float) – The start angle.

  • sweepAngle (float) – The sweep angle.

  • rotation (float) – The amount of rotation.

Return type:

None

Raises:

FMEException – An exception is raised if an error occurred.

convertArcToPointUseAttributes()

Return the bounding cube of the feature in the format ((min x, min y, min z), (max x, max y, max z)) Strokes an arc feature to be a polygon or line. The parameters used to stroke the arc or ellipse are retrieved from the related attributes. Arcs with a sweep angle of 360 degrees will be converted into a polygon.

Return type:

None

Raises:

FMEException – An exception is raised if an error occurred.

convertArcToPoints(center, semiPrimaryAxis, semiSecondaryAxis, origNumSamps, startAngle, endAngle, rotation)

Strokes an arc feature to be a polygon or line.

Parameters:
  • center ((float, float)) – The center coordinate.

  • semiPrimaryAxis (float) – The semi-primary axis.

  • semiSecondaryAxis (float) – The semi-secondary axis.

  • origNumSamps (int) – The original number of samples.

  • startAngle (float) – The start angle.

  • endAngle (float) – The end angle.

  • rotation (float) – The amount of rotation.

Return type:

None

Raises:

FMEException – An exception is raised if an error occurred.

convertPointsToArc(radiusAttrName, startAngleAttrName, sweepAngleAttrName)

Converts the feature into a point feature with attributes required to define it as an arc. If the feature has more than 3 points, the arc is approximated.

Parameters:
  • radiusAttrName (str) – The name of the radius attribute.

  • startAngleAttrName (str) – The name of the start angle attribute.

  • sweepAngleAttrName (str) – The name of the sweep angle attribute.

Return type:

None

Raises:

FMEException – An exception is raised if an error occurred.

deserialize(buffer, parameters)

Restore the state of the FMEFeature from the specified buffer.

Parameters:
  • buffer (bytearray) – The buffer from which the state of the feature is restored from.

  • parameters (dict) – (Optional) Possible name-value pairs are:

  • kFME_FeatureDeserializeOption:

    • kFME_FeatureDeserializeReset: (Default) Reset the original feature before restoring the state of the FMEFeature.

    • kFME_FeatureDeserializeMerge: When restoring the state of the FMEFeature, the original feature will NOT be reset; the original information in the feature will be preserved when there is no corresponding information in the buffer. Attributes, geometry, coordinate system information, etc. taken from the buffer will overwrite such information on the feature if necessary.

  • kFME_FeatureDeserializeSidecarBasename:

    • File from which to read extra geometry data: The path and basename (not including file extension) from which additional data will be read for some geometries (raster, point cloud). If this option is not specified for those geometries, they may return an error when data is requested (e.g. when writing out a raster).

Return type:

bool

Returns:

True on success, False otherwise.

exportGeometryToOGCWKB(version)

Convert the geometry of the feature to the OGC Well Known Binary format.

Parameters:

version (int) –

(Optional) The OGC Version to use. Must be one of:

(Default value is ogcvOneDotOne).

Return type:

bytearray, bytes, or None

Returns:

A buffer representing the geometry of the feature converted to the OGCWKB.

Raises:

FMEException – An exception is raised if an error occurred.

exportGeometryToOGCWKT(version)

Convert the geometry of the feature to the OGC Well Known Text format.

Parameters:

version (int) –

(Optional) The OGC Version to use. Must be one of:

(Default value is ogcvOneDotOne).

Return type:

str

Returns:

A string representing the geometry of the feature converted to the OGCWKT.

Raises:

FMEException – An exception is raised if an error occurred.

generatePointInPolygon(pretty)

Generate a point somewhere inside the polygon. If the feature is 3D, the Z value is calculated to be the average of all points on the feature.

Parameters:

pretty (bool) – (Optional) Generate a point that has a more central position, however more computational time may be required (default is False).

Return type:

tuple[float]

Returns:

A point somewhere inside the polygon.

Raises:

FMEException – An exception is raised if an error occurred.

getAllAttributeNames()

This method returns a complete, exhaustive list of all the attribute names present in the feature.

Return type:

list[str]

Returns:

A list of all the attribute names present in the feature.

getAllCoordinates()

Get all the coordinates in this feature. Returns a list of coordinates, each as a tuple of floats.

Return type:

list[tuple[float]]

Returns:

A list of coordinates in the feature.

getAttribute(attrName, desiredType, fallback)

Get the value of the named attribute. Null attribute values will be returned as an empty string. Binary blob attributes are returned as bytes.

For list attributes, an example list name could be “adjacentIds”, which would return a list of all the values found for “adjacentIds{0} … adjacentIds{N}”. The function also accepts a “structured list” specification, such as “attrInfo{}.name”, which would return a list of all the values found for “attrInfo{0}.name … attrInfo{N}.name”.

In cases where there is ambiguity between retrieving an attribute value and a list attribute, the attrName should be appended with “{}” in order to retrieve the list (i.e. the attrName “fme_type” should be “fme_type{}”).

A return of None indicates the attribute or list attribute does not exist.

For null attribute values, an empty string will be returned. In order to determine if an attribute is null, use isAttributeNull.

Specifying a desired type will return the attribute value in the type specified. If the attribute value cannot be represented in the desired type, an exception will be raised.

In any cases where this method will fail either by a raised exception or a missing value, the method will return the fallback value if it’s specified.

Parameters:
  • attrName (str) – The name of the attribute to get on the feature.

  • desiredType (type) – (Optional) The desired type for the attribute value to be returned as. Possible values are bool, int, float, str, bytes, bytearray, and list.

  • fallback (bool, int, float, str, bytes, bytearray, list, or None) – (Optional) If specified, this value is returned instead of raising FMEException on conversion failures.

Return type:

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

Returns:

The value of the named attribute.

Raises:

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

getAttributeAsType(attrName, attrType, fallback)

This method is deprecated as of FME 2021.0. Please use getAttribute with desired type instead.

Get the value of the named attribute, casted to the specified FME type, then to an appropriate python type.

An optional third parameter can be specified to be returned as a fallback in case type conversion fails.

Example: getAttributeAsType(“output_file_type”, fmeobjects.FME_ATTR_STRING, “png”)

The enum value fmeobjects.FME_ATTR_UNDEFINED can be used to retrieve a list object. If used to try and get a single attribute as a list, or a list as a single type, there is automatic conversion failure.

A return of None indicates the attribute does not exist.

Parameters:
  • attrName (str) – The name of the attribute to get on the feature.

  • attrType (int) – The integer representing the desired FME type.

  • fallback (any) – (Optional) If specified, this value is returned instead of raising FMEException on conversion failures.

Return type:

bool, int, float, str, list[str], bytearray, list[bytearray], bytes, list[bytes], or None

Returns:

The value of the named attribute.

Raises:

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

getAttributeNullMissingAndType(attributeName)

This method is deprecated as of FME 2021.0. Please use isAttributeNull, isAttributeMissing, and getAttributeType instead.

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

Parameters:

attributeName (str) – The name of the attribute.

Return type:

tuple[bool, bool, int]

Returns:

A tuple of 2 boolean values and an integer. The first boolean indicating whether or not the value of the attribute is null, the second boolean indicating whether or not the attribute is missing, and the integer representing the attribute type. Attribute type int values are represented by the constants 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, or FME_ATTR_UINT64.

getAttributeType(attrName)

Get the type of the named attribute.

Parameters:

attrName (str) – The name of the attribute to get on the feature.

Return type:

int

Returns:

The attribute type of the named attribute. Attribute types are int values represented by the constants 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, or FME_ATTR_UINT64.

getCoordSys()

Get the Coordinate System of the feature.

Return type:

str

Returns:

The coordinate system of the feature.

getCoordinate(index)

Access the feature’s individual coordinates by index. The index must be in the range 0 .. ( numCoords() - 1).

The coordinates are returned as a tuple of floats.

Parameters:

index (int) – The index which the coordinate is accessed.

Return type:

tuple[float]

Returns:

The coordinate value at the given index.

Raises:

FMEException – An exception is raised if the index is outside the valid range.

getDimension()

Get the dimension of the feature.

Returns either FME_TWO_D or FME_THREE_D

Return type:

int

Returns:

The dimension of the feature.

getDonutParts()

Break a donut feature into its constituent parts. The first part is the outer shell of the donut polygon, and the following parts are the holes. All of the parts have the same attributes and feature type as the original feature.

Return type:

list[FMEFeature]

Returns:

A list of features representing the constituent parts of the original donut.

Raises:

FMEException – An exception is raised if an error occurred.

getFeatureType()

Get the Feature Type of the feature.

Return type:

str

Returns:

The feature type.

getGeometry()

Get the feature’s geometry.

Return type:

FMEGeometry

Returns:

The geometry of the feature. Note: This method returns a terminal geometry type of the FMEGeometry; i.e. one of the leaf classes in the FMEGeometry inheritance graph. For example, a FMEPoint is returned if the geometry truly is a point.

getGeometryType()

Get the feature’s classic geometry type.

Returns one of FME_GEOM_UNDEFINED, FME_GEOM_POINT, FME_GEOM_LINE, FME_GEOM_POLYGON, FME_GEOM_DONUT, FME_GEOM_PIP, or FME_GEOM_AGGREGATE.

Return type:

int

Returns:

The geometry type of the feature.

getSequencedAttributeNames()

This method gets a list of sequenced attribute names in the order they were added to the feature. The attrNames list is only populated for schema features. The list will not contain sequenced attribute names for data features.

Return type:

list[str]

Returns:

A list of attribute names in the order they were added to the feature..

hasGeometry()

This method is deprecated as of FME 2022.1.

Determine if a feature has geometry.

Return type:

bool

Returns:

True if the feature has a geometry and False otherwise.

hasRichGeometry()

This method is deprecated as of FME 2021.0.

Determine if the feature has geometry that takes advantage of the new geometry technology.

Return type:

bool

Returns:

True if the feature’s geometry takes advantage of the new geometry technology, and False otherwise.

importGeometryFromOGCWKB(ogcwkb)

Set the geometry of the feature to be that specified in the OGC Well Known Binary format. If the feature has geometry, then the geometry is replaced.

Parameters:

ogcwkb (bytearray) – Specifies the geometry of the feature.

Return type:

None

Raises:

FMEException – An exception is raised if an error occurred.

importGeometryFromOGCWKT(ogcwkt)

Set the geometry of the feature to be that specified in the OGC Well Known Text format. If the feature has geometry, then the geometry is replaced.

Parameters:

ogcwkt (str) – Specifies the geometry of the feature.

Return type:

None

Raises:

FMEException – An exception is raised if an error occurred.

interpolateSpline(numPointsPerSegment, calcPhantomPoints)

Perform interpolation on the feature.

Parameters:
  • numPointsPerSegment (int) – The number of points per segment.

  • calcPhantomPoints (bool) – Whether to calculate phantom points.

Return type:

None

Raises:

FMEException – An exception is raised if an error occurred.

isAttributeMissing(attributeName)

This method returns a boolean indicating if the attribute name maps to no value on the feature.

Parameters:

attributeName (str) – The name of the attribute.

Return type:

bool

Returns:

A boolean indicating if the attribute is missing.

isAttributeNull(attributeName)

This method returns a boolean indicating if the attribute name maps to a null attribute value on the feature.

Parameters:

attributeName (str) – The name of the attribute.

Return type:

bool

Returns:

A boolean indicating if the attribute is null.

makeDonuts(featureList)

Construct a donut polygon from the list of features provided. If multiple donut polygons are formed then the resulting geometry is an aggregate of these donuts.

Parameters:

featureList (list[FMEFeature]) – The list of features to make the donut from.

Return type:

None

Raises:

FMEException – An exception is raised if an error occurred.

matrixTransform(matrix)

Perform a 2D or 3D matrix transformation on the feature. Note: The passed in matrix must be in row-wise order.

Parameters:

matrix (((float, float), (float, float)) or ((float, float, float), (float, float, float), (float, float, float))) – The matrix to use for the transformation.

Return type:

None

Raises:

FMEException – An exception is raised if an error occurred.

mergeAttributes(destFeature)

Set the featureType and attributes of the feature passed in from the current feature, but ONLY if those attributes are not already present. The geometry is not touched. The original attributes on the destFeature are not lost.

Parameters:

destFeature (FMEFeature) – The original feature to set featureType and attributes on.

Return type:

None

Raises:

FMEException – An exception is raised if an error occurred.

numCoords()

Get the number of coordinates in the feature.

We recommend limited use of this method since it returns numVertices() + numParts() for multi-part features. A true vertex count will be returned by numVertices().

Return type:

int

Returns:

Returns the number of coordinates in the feature.

numParts(flatten, splitDonuts)

Get the number of parts that make up the geometry of the feature.

Parameters:
  • flatten (bool) – If flatten is True, then return the number of primitive parts drilling down into sub aggregates. If flatten is False then it returns the number of high level parts with some parts potentially being aggregates.

  • splitDonuts (bool) – If splitDonuts is True, each ring of a donut will count as a separate part.

Return type:

int

Returns:

The number of parts that make up the feature.

numVertices()

Get the number of vertices that make up the geometry of the feature Multi-part (aggregate) geometries are handled properly.

For simple geometries, the same value is returned as in numCoords()

Return type:

int

Returns:

The number of vertices that make up the feature.

offset(x, y, z)

Offsets the feature by the given amounts. (2D or 3D)

Parameters:
  • x (float) – The x coordinate to offset by.

  • y (float) – The y coordinate to offset by.

  • z (float) – (Optional) The z coordinate to offset by. (Default value is 0.0)

Return type:

None

Raises:

FMEException – An exception is raised if an error occurred.

orient(rule)

Optionally set and get the orientation rule of the feature. This descends into aggregates and orients any polygons or donuts found. Geometries other than polygons or donuts are left unchanged.

Parameters:

rule (int) –

(Optional) If the parameter is not supplied, the orientation is not changed. If the rule is supplied, the feature is adjusted so that rule is followed.

With the right hand rule, the area of the polygon is always on the right and the coordinates of the outer boundary are in the clockwise direction, and for any holes they are counterclockwise.

Return type:

int

Returns:

The orientation rule of the feature.

Raises:

FMEException – An exception is raised if an error occurred..

outerShell()

Set the geometry of the feature to be just its outer shell. This has no effect on non-area features.

Return type:

None

Raises:

FMEException – An exception is raised if an error occurred.

performFunction(functionSpecification)

Call an FME function on the feature. See the FME Factory and Function Documentation for formatting and the list of supported functions. It may not support newer FME functions. Functions that are not supported will produce an error message indicating that the function is not recognized. The function string passed in to this function follows the syntax of the documentation exactly.

i.e. feature.performFunction(‘@Count()’)

Note that no spaces should be present between any parameters of the function, or between the function name and the ‘(‘. Additionally, do not call this method during a writer’s close() method.

Parameters:

functionSpecification (str) – The function specification.

Return type:

str

Returns:

The function’s result.

Raises:

FMEException – An exception is raised if an error occurred.

processFeatures(featureList, paramList)

Perform some general processing operation on a list of features. The operation performed is governed by the contents of paramList.

Parameters:
  • featureList (list[FMEFeature]) – The list of features to process.

  • paramList (list[str]) –

    The first entry in the array determines the type of operation.

    The following types of operations are supported:

    • kFME_ConvertToArea: The contents of the feature list are assumed to be a collection of lines. These lines are then formed into polygons. The polygons which result are turned into donuts and aggregated. Any holes are themselves dropped from the result. The single resulting area geometry is applied to the current feature.

    • kFME_PolygonDissolve: The contents of the feature list are assumed to be a collection of polygons. If there are non-polygon features, then they will be filtered out. The collection of polygon features will be dissolved and the result will be applied to the current feature. Dissolved polygons are those polygons formed when shared edges between adjacent polygons are removed. This operation assumes that all input polygons are properly noded, a vertex is present at each intersection point, and that polygons are not overlapping.

Return type:

None

Raises:

FMEException – An exception is raised if an error occurred. The current feature’s geometry may be in an undefined state.

removeAttribute(attrName)

Remove the named attribute if it exists.

Parameters:

attrName (str) – The name of the attribute to remove.

Return type:

None

removeAttrsWithPrefix(attrPrefix)

Remove the named attribute if it exists.

Parameters:

attrName (str) – The name of the attribute to remove.

Return type:

None

removeGeometry()

Remove and return the feature’s geometry. The feature loses its geometry and it can no longer be accessed.

Return type:

FMEGeometry

Returns:

The geometry of the feature. Note: This method returns a terminal geometry type of the FMEGeometry; i.e. one of the leaf classes in the FMEGeometry inheritance graph. For example, a FMEPoint is returned if the geometry truly is a point.

removeTraits(regexp)

Remove all or matching traits from the feature.

Parameters:

regexp (str) – (Optional) All traits matching this regular expression are removed. If no expression is supplied, all traits are removed.

Return type:

None

reproject(coordSys)

Reproject the feature from its current coordinate system to that specified. If the feature has no coordinate system specified then this has the same effect as the setCoordSys method.

Parameters:

coordSys (str) – The coordinate system to set on the feature.

Return type:

None

Raises:

FMEException – An exception is raised if an error occurred.

resetCoords()

Reset the number of coordinates in the feature to 0.

Return type:

None

resetFeature()

Reset (clear) all the attributes and geometry of the feature. It results in a fresh clean feature.

Return type:

None

Raises:

FMEException – An exception is raised if an error occurred.

rotate2D(origin, angle)

Rotate the feature counterclockwise around the origin point by the specified angle (in degrees).

Parameters:
  • origin ((float, float)) – The origin of the feature.

  • angle (float) – The angle (in degrees) which to rotate the feature in the counterclockwise direction.

Return type:

None

Raises:

FMEException – An exception is raised if an error occurred.

scale(x, y, z)

Scale the feature by the given amounts. (2D or 3D)

Parameters:
  • x (float) – The value to scale x by.

  • y (float) – The value to scale y by.

  • z (float) – (Optional) The value to scale z by. (Default value is 1.0)

Return type:

None

Raises:

FMEException – An exception is raised if an error occurred.

serialize(parameters)

Write the state of the FMEFeature to a string buffer.

Parameters:

parameters (dict) –

(Optional) Possible name-value pairs are:

  • kFME_FeatureSerializeOption:

  • kFME_FeatureSerializeExcludeAttr:

    • Attribute names to exclude: The names of the attributes to exclude when doing feature serialization. The value can be a single string or a list.

  • kFME_FeatureSerializeSidecarBasename:

    • File in which to store extra geometry data: The path and basename (not including file extension) to which additional data will be written for some geometries (raster, point cloud). If this option is not specified for those geometries, the extra data will not be written.

Return type:

bytearray, bytes, or None

Returns:

The buffer on success, None otherwise.

setAttribute(attrName, attrValue)

Supply a new attribute for the feature. If the attribute already exists, it will be overwritten. The following type numeric mappings are used:

PyInt ==> FME_Int32

PyFloat ==> FME_Real64

PyLong ==> FME_Int64

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

If an attribute value of None is specified, the attribute value will be set as an empty string. To set a null attribute, use setAttributeNullWithType.

For a list attribute, if the attribute already exists and contains more elements than the new list, the resulting list will be made up of the new list elements plus the old list elements that were not overwritten. Call removeAttribute first to avoid this behavior. Passing an empty list for the attribute value will have no effect.

Parameters:
Return type:

None

setAttributeNullWithType(attributeName, attributeType)

This method supplies a null attribute with a type to the feature. If an attribute with the same name already exists, it is overwritten.

Attribute 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 or FME_ATTR_UINT64.

Parameters:
  • attributeName (str) – The attribute’s name.

  • attributeType (int) – An integer representing the attribute type.

Return type:

None

setCoordSys(coordSys)

Set the Coordinate System of the feature.

Parameters:

coordSys (str) – The coordinate system to set on the feature.

Return type:

None

setDimension(dimension)

Dimension must either be FME_TWO_D or FME_THREE_D

Parameters:

dimension (int) – The dimension to set on the feature.

Return type:

None

setFeatureType(featureType)

This method sets the feature type of the FMEFeature. The feature type is often also called the “class” or “category” of the feature.

The feature type set on a feature through this method will change as the feature is routed through a translation pipeline.

Parameters:

featureType (str) – The feature type to set on the feature.

Return type:

None

setGeometry(geometry)

Set the feature’s geometry. Any existing geometry on the feature is overwritten.

Parameters:

geometry (FMEGeometry) – The geometry to set the feature to.

Return type:

None

setGeometryType(geomType)

Set the feature’s classic geometry type.

geomType must one of: FME_GEOM_UNDEFINED, FME_GEOM_POINT, FME_GEOM_LINE, FME_GEOM_POLYGON, FME_GEOM_DONUT, FME_GEOM_PIP, or FME_GEOM_AGGREGATE.

Parameters:

geomType (int) – The geometry type to set the feature to.

Return type:

None

setSequencedAttribute(attrName, attrValue)

Supply a new attribute for the feature, but in such a way that the sequence is remembered. This is needed for schema features, to preserve the order of attributes.

For a list attribute, if the attribute already exists and contains more elements than the new list, the resulting list will be made up of the new list elements plus the old list elements that were not overwritten. Call removeAttribute first to avoid this behavior.

Parameters:
  • attrName (str) – The name of the attribute to set.

  • attrValue (str, list[str]) – The new value for the attribute.

Return type:

None

splitAggregate(recurse)

Split up an aggregate feature into pieces, all of which have the same attributes and feature type. If the recurse flag is True, all aggregates within the aggregate are also split recursively, so no aggregates are ever returned as pieces. This method will only return points, lines, polygons, and null geometries (and possibly aggregates if recurse is False). All other geometries will be converted to these when split.

Parameters:

recurse (bool) – (Optional) Whether to recursively split the aggregate until no aggregates remain. (Default value is False)

Return type:

list[FMEFeature]

Returns:

A list of features resulting from the splitting of the original aggregate.

Raises:

FMEException – An exception is raised if an error occurred.