Skip to content

Reference

ImxObject

Represents an object within an IMX file.

Info

This class is used to encapsulate the data and functionality for an object within an IMX file. It contains attributes parsed from the XML element representing the object, and methods to manipulate and query the object.

Todo

= Find way to make immutable after building repo. - Move back to repo, specific types like trackassets should be in domain.

Parameters:

Name Type Description Default
element _Element

The XML element representing the object.

required
imx_file ImxFile

The IMX file associated with the object.

required
parent Optional[ImxObject]

The parent ImxObject of the object. Defaults to None.

None

Attributes:

Name Type Description
element _Element

Returns the XML element representing the object.

tag str

Returns the tag of the XML element.

path str

Returns the path of the object within the XML structure.

name str

Returns the name attribute of the XML element.

puic str

Returns the puic attribute of the XML element.

geometry LineString | Point | Polygon | MultiLineString | MultiPoint | MultiPolygon | GeometryCollection

Object geometer

geographic_location ImxGeographicLocation | None

Returns the geographic location associated with the object.

extend_imx_object(imx_extension_object)

Extends the current ImxObject with another ImxObject.

Parameters:

Name Type Description Default
imx_extension_object ImxObject

The ImxObject to extend with.

required

can_compare(other)

Checks if the object can be compared with another object.

Parameters:

Name Type Description Default
other ImxObject

The other ImxObject to compare with.

required

Returns:

Name Type Description
bool bool

True if the objects can be compared, False otherwise.

lookup_tree_from_imx_file(imx_file) classmethod

Generates a lookup tree from an IMX file.

Parameters:

Name Type Description Default
imx_file ImxFile

The IMX file.

required

Returns:

Type Description
list[ImxObject]

List[ImxObject]: The lookup tree generated from the IMX file.

lookup_tree_from_element(element, imx_file) classmethod

Generates a lookup tree from a specific XML element within an IMX file.

Parameters:

Name Type Description Default
element _Element

The XML element to start building the lookup tree from.

required
imx_file ImxFile

The IMX file associated with the XML element.

required

Returns:

Type Description
list[ImxObject]

List[ImxObject]: The lookup tree generated from the XML element.

ImxGeographicLocation dataclass

Represents a geographic location with attributes parsed from an XML element.

Attributes:

Name Type Description
shapely Point | LineString | Polygon

The Shapely geometric representation of the location.

azimuth Optional[float]

The azimuth of the location, if available.

data_acquisition_method Optional[str]

The method used to acquire the geographic data.

accuracy Optional[float]

The accuracy of the geographic data.

srs_name Optional[str]

The spatial reference system name.

from_element(element) staticmethod

Create an ImxGeographicLocation instance from an XML element.

Info

This method parses geographic location data from the given XML element and creates an instance of ImxGeographicLocation with the parsed data.

Parameters:

Name Type Description Default
element Element

The XML element to parse.

required

Returns:

Type Description
Optional[ImxGeographicLocation]

Optional[ImxGeographicLocation]: An instance of ImxGeographicLocation if the element contains

Optional[ImxGeographicLocation]

geographic location data, otherwise None.