src.utils_flask_sqla_geo.generic

Module Contents

Classes

GenericTableGeo

Classe permettant de créer à la volée un mapping

GenericQueryGeo

Classe permettant de manipuler des objets GenericTable

Functions

get_geojson_feature(wkb)

retourne une feature geojson à partir d'un WKB

src.utils_flask_sqla_geo.generic.get_geojson_feature(wkb)[source]

retourne une feature geojson à partir d’un WKB

class src.utils_flask_sqla_geo.generic.GenericTableGeo(tableName, schemaName, engine, geometry_field=None, srid=None)[source]

Bases: utils_flask_sqla.generic.GenericTable

Classe permettant de créer à la volée un mapping

d’une vue avec la base de données par rétroingénierie gère les géométries

as_geofeature(data, columns=[], fields=[])[source]
as_shape(db_cols, geojson_col=None, data=[], dir_path=None, file_name=None)[source]

# RMQ Pour le moment conservé pour des questions de rétrocompatibilité

Create shapefile for generic table Parameters:

db_cols (list): columns from a SQLA model (model.__mapper__.c) geojson_col (str): the geojson (from st_asgeojson()) column of the mapped table if exist

if None, take the geom_col (WKB) to generate geometry with shapely

data (list<Model>): list of data of the shapefiles dir_path (str): directory path file_name (str): name of the file

Returns

Void (create a shapefile)

as_geofile(export_format, db_cols, geojson_col=None, data=[], dir_path=None, file_name=None)[source]

Create shapefile or geopackage for generic table Parameters:

export_format (str): file format (shp or gpkg) db_cols (list): columns from a SQLA model (model.__mapper__.c) geojson_col (str): the geojson (from st_asgeojson()) column of the mapped table if exist

if None, take the geom_col (WKB) to generate geometry with shapely

data (list<Model>): list of data of the shapefiles dir_path (str): directory path file_name (str): name of the file

Returns

Void (create a shapefile)

class src.utils_flask_sqla_geo.generic.GenericQueryGeo(DB, tableName, schemaName, filters=[], limit=100, offset=0, geometry_field=None, srid=None)[source]

Bases: utils_flask_sqla.generic.GenericQuery

Classe permettant de manipuler des objets GenericTable gère les géométries

as_geofeature()[source]
get_model(pk_name: str | None = None)[source]

renvoie le modèle associé à la table

get_marshmallow_schema(pk_name: str | None = None)[source]

renvoie un marshmalow schema à partir d’un modèle ce schema hérite des classes GeoAlchemyAutoSchema et SmartRelationshipsMixin

TODO (à déplacer dans les lib utils sqla)