Core geometries module¶
as_unified_geometry(source_geom: geometry.Polygon | geometry.MultiPolygon) -> geometry.Polygon
¶
Ensures the calculated geometry is returned as a single polygon.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
source_geom |
geometry.Polygon | geometry.MultiPolygon
|
Calculated source geometry. |
required |
Returns:
Type | Description |
---|---|
geometry.Polygon
|
geometry.Polygon: Unified resulting geometry with its points ordered (first one is the most-left x coordinate). |
get_groundlevel_surface(pol_geometry: geometry.Polygon) -> geometry.LineString
¶
Returns all the points which are at 'groundlevel' values (y = 0)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pol_geometry |
geometry.Polygon
|
Source geometry. |
required |
Returns:
Type | Description |
---|---|
geometry.LineString
|
geometry.LineString: Line with points at y = 0. |
get_normalized_polygon_difference(left_geom: geometry.Polygon, right_geom: geometry.Polygon) -> geometry.Polygon | geometry.MultiPolygon
¶
Given two polygons calculates the difference between them and removes any residual polygon due to minor precision errors.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
left_geom |
geometry.Polygon
|
Base polygon from where to substract. |
required |
right_geom |
geometry.Polygon
|
Polygon to substract from base. |
required |
Returns:
Type | Description |
---|---|
geometry.Polygon | geometry.MultiPolygon
|
geometry.Polygon: Resulting normalized substraction polygon. |
get_polygon_coordinates(pol_geometry: geometry.Polygon | geometry.MultiPolygon) -> geometry.LineString
¶
Given a single or multi geometry returns the coordinates composing its outer layout.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pol_geometry |
geometry.Polygon | geometry.MultiPolygon
|
Source geometry. |
required |
Raises:
Type | Description |
---|---|
NotImplementedError
|
When the provided geometry is not yet supported. |
Returns:
Type | Description |
---|---|
geometry.LineString
|
geometry.LineString: Set of points composing the outer layout of the geometry. |
get_polygon_surface_points(base_geometry: geometry.Polygon | geometry.MultiPolygon) -> geometry.LineString
¶
Gets all the points composing the upper surface of a 'dike' geometry.
IMPORTANT! The calling of this method assumes the base_geometry
points are in order, call order_geometry_points
if needed.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
base_geometry |
Union[geometry.Polygon, geometry.MultiPolygon]
|
Source geometry. |
required |
Returns:
Type | Description |
---|---|
geometry.LineString
|
geometry.LineString: Resulting line with points from the outer geometry. |
get_relative_core_layer(core_geometry: geometry.Polygon, coating_geometry: geometry.Polygon) -> geometry.Polygon
¶
Returns a new 'core' from the original core_geometry
relative to the coating_geometry
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
core_geometry |
Polygon
|
Original core geometry on which layers are stacked upon. |
required |
coating_geometry |
Polygon
|
Layer wrapping the exterior of a core geometry. |
required |
Returns:
Name | Type | Description |
---|---|---|
Polygon |
geometry.Polygon
|
Layer wrapping a reduced surface of the |
order_geometry_points(dike_polygon: geometry.Polygon) -> geometry.Polygon
¶
In koswat we handle polygon operations expecting the lowest 'x' coordinate to be the initial and last point of a geometry. For this reason we need to ensure all geometries are 'normalized' based on this criteria.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dike_polygon |
geometry.Polygon
|
Polygon to normalized. |
required |
Returns:
Type | Description |
---|---|
geometry.Polygon
|
geometry.Polygon: Normalized polygon. |
profile_points_to_polygon(points_list: list[geometry.Point]) -> geometry.Polygon
¶
Transforms a list of points into a valid 'dike' polygon. When there is a difference in height between left and right side then we correct it in the x = 0 coordinate.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
points_list |
List[geometry.Point]
|
List of points representing a dike profile. |
required |
Returns:
Type | Description |
---|---|
geometry.Polygon
|
geometry.Polygon: Validated enclosed geometry simple polygon. |
remove_layer_from_polygon(dike_polygon: geometry.Polygon, layer_depth: float) -> geometry.Polygon
¶
Gets the dike profile without a layer of provided layer_depth
depth.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dike_polygon |
geometry.Polygon
|
Source geometry. |
required |
layer_depth |
float
|
Depth of a layer from the outer |
required |
Returns:
Type | Description |
---|---|
geometry.Polygon
|
geometry.Polygon: Resulting geometry when removing the layer. |