deseasion.backend.models.geo_data_utils module

class deseasion.backend.models.geo_data_utils.GeometryFeature(ids, geometry)

Bases: object

difference(other)
difference_union(geoms)
classmethod from_dict(value)
intersection(other)
intersects(other)
is_empty()
is_valid()
split_multi_geometries() list[GeometryFeature]
to_dict()
touches(other)
class deseasion.backend.models.geo_data_utils.ModelProcessingService

Bases: object

buffer_geometries(distance, geometries)

Create a buffer around the geometries.

The geometries are cast to a geography type in PostGIS, allowing to use a distance in metres for the buffer.

Args:

distance: The distance of the buffer. geometries (iterable): Iterable of GeometryFeature objects

Returns:

A new list of GeometryFeature objects with a buffer around the geometries.

decompose(geometries_1, geometries_2, r_tree1, feedback)
dissolve_adjacent_features(data_id)

Dissolve the adjacent features with the same attributes values.

get_decomposed_data(model)
get_geometries_area(geometries)

Return the areas of the geometries.

Calculates the area in PostGIS by casting the geometries to Geography data, allowing to have the area in square metres.

Args:

geometries (list): List of GeometryFeature objects.

process_model(model, feedback)

Process the model on the geometries.

Args:

model: A processing model. geometries (list): A list of GeometryFeature objects.

Returns:

A list of Feature objects.

set_project_data_features(project_data, features, filter_none=True)

Save the features.

If a geo data already exists, the old features are replaced by the features given in arguements. If no geo data exists, a new one is created using the features.

Args:

project_data (ProjectData) features (list of GeoFeature) filter_none (bool): Remove the features with only None values

(default: True)

deseasion.backend.models.geo_data_utils.check_geom_type(geom)