ogstools.ogs6py.geo module#

class ogstools.ogs6py.geo.Geo[source]#

Bases: BuildTree, StorageBase

Class managing the geometry file (.gml) for an OGS project.

Tracks both the XML reference to the geometry and the actual file, enabling proper save/copy operations.

Initialize a Geo object.

Parameters:
  • tree (ElementTree) – The Project’s XML ElementTree (shared reference)

  • source_path – Path to the source .gml file (if known)

  • id (str | None) – Optional unique identifier

__init__(tree, id=None)[source]#

Initialize a Geo object.

Parameters:
  • tree (ElementTree) – The Project’s XML ElementTree (shared reference)

  • source_path – Path to the source .gml file (if known)

  • id (str | None) – Optional unique identifier

property filename: str | None#

Get the geometry filename from the XML tree.

property has_geometry: bool#

Check if geometry is defined (either as file or inline in XML).

add_geometry(file_pathname)[source]#

Add/set a geometry file.

Parameters:

filename – The file path and name of the gml file

Return type:

None

save(target=None, overwrite=None, dry_run=False, archive=False, id=None)[source]#

Save the geometry file.

Parameters:
  • target (Path | str | None) – Optional target path

  • overwrite (bool | None) – If True, overwrite existing files

  • dry_run (bool) – If True, simulate without writing

  • archive (bool) – If True, materialize symlinks

  • id (str | None) – Optional identifier. Mutually exclusive with target.

Return type:

list[Path]

Returns:

List of saved file paths