dicogis.georeaders.process_files module¶
- class dicogis.georeaders.process_files.DatasetToProcess(file_path, file_format, georeader, processed=False, process_error=None, exported=False, export_error=None)¶
Bases:
objectModel of a geofile to process.
- __init__(file_path, file_format, georeader, processed=False, process_error=None, exported=False, export_error=None)¶
- class dicogis.georeaders.process_files.ProcessingFiles(serializer, localized_strings, li_cdao, li_dxf, li_flat_geodatabase_esri_filegdb, li_flat_geodatabase_geopackage, li_flat_geodatabase_spatialite, li_geojson, li_gxt, li_gml, li_kml, li_mapinfo_tab, li_shapefiles, li_vectors, li_rasters, li_file_databases, opt_analyze_esri_filegdb=True, opt_analyze_geojson=True, opt_analyze_geopackage=True, opt_analyze_gml=True, opt_analyze_gxt=True, opt_analyze_kml=True, opt_analyze_mapinfo_tab=True, opt_analyze_raster=True, opt_analyze_cdao=True, opt_analyze_shapefiles=True, opt_analyze_spatialite=True, progress_reporter=None, opt_quick_fail=False)¶
Bases:
objectGeofiles processor.
- MATRIX_DATASET_TYPE_METADATASET: dict[str, type[MetaDataset]] = {'flat_cad': <class 'dicogis.models.metadataset.MetaVectorDataset'>, 'flat_database': <class 'dicogis.models.metadataset.MetaDatabaseFlat'>, 'flat_raster': <class 'dicogis.models.metadataset.MetaRasterDataset'>, 'flat_vector': <class 'dicogis.models.metadataset.MetaVectorDataset'>}¶
- MATRIX_FORMAT_GEOREADER = {'dxf': <class 'dicogis.georeaders.read_dxf.ReadCadDxf'>, 'esri_shapefile': <class 'dicogis.georeaders.read_vector_flat_dataset.ReadVectorFlatDataset'>, 'file_geodatabase_esri': <class 'dicogis.georeaders.read_vector_flat_geodatabase.ReadFlatDatabase'>, 'file_geodatabase_geopackage': <class 'dicogis.georeaders.read_vector_flat_geodatabase.ReadFlatDatabase'>, 'file_geodatabase_spatialite': <class 'dicogis.georeaders.read_vector_flat_geodatabase.ReadFlatDatabase'>, 'geojson': <class 'dicogis.georeaders.read_vector_flat_dataset.ReadVectorFlatDataset'>, 'geotiff': <class 'dicogis.georeaders.read_raster.ReadRasters'>, 'gml': <class 'dicogis.georeaders.read_vector_flat_dataset.ReadVectorFlatDataset'>, 'gxt': <class 'dicogis.georeaders.read_vector_flat_dataset.ReadVectorFlatDataset'>, 'kml': <class 'dicogis.georeaders.read_vector_flat_dataset.ReadVectorFlatDataset'>, 'mapinfo_tab': <class 'dicogis.georeaders.read_vector_flat_dataset.ReadVectorFlatDataset'>, 'raster': <class 'dicogis.georeaders.read_raster.ReadRasters'>}¶
- __init__(serializer, localized_strings, li_cdao, li_dxf, li_flat_geodatabase_esri_filegdb, li_flat_geodatabase_geopackage, li_flat_geodatabase_spatialite, li_geojson, li_gxt, li_gml, li_kml, li_mapinfo_tab, li_shapefiles, li_vectors, li_rasters, li_file_databases, opt_analyze_esri_filegdb=True, opt_analyze_geojson=True, opt_analyze_geopackage=True, opt_analyze_gml=True, opt_analyze_gxt=True, opt_analyze_kml=True, opt_analyze_mapinfo_tab=True, opt_analyze_raster=True, opt_analyze_cdao=True, opt_analyze_shapefiles=True, opt_analyze_spatialite=True, progress_reporter=None, opt_quick_fail=False)¶
- add_files_to_process_queue(list_of_datasets, dataset_format)¶
Add dataset to the processing queue.
- Parameters:
- Return type:
- Returns:
list of files to process
- count_files_to_process()¶
Count number of files to process.
- Return type:
- Returns:
total of files to process
- export_metadataset(dataset_to_process, metadataset_to_serialize)¶
Serialize metadataset in a generic way.
- Parameters:
dataset_to_process (
DatasetToProcess) – dataset to process used to store statusmetadataset_to_serialize (
MetaDataset) – metadataset to serialize
- Return type:
- Returns:
dataset to process, metadataset or None if something went wrong
- failed_metadataset(dataset_to_process, dataset_type, error)¶
Describe a dataset whose reading raised, so that it can be serialized as an error (e.g. a highlighted row in its Excel sheet).
- Parameters:
dataset_to_process (
DatasetToProcess) – dataset which failed to be readdataset_type (
str|None) – dataset_type of the georeader used, picking the modelerror (
Exception) – exception raised while reading
- Return type:
- Returns:
metadataset with name, path and error filled, processing_succeeded False
- li_files_to_process: list[DatasetToProcess | None]¶
- process_datasets_in_queue()¶
Process datasets in queue.
- Raises:
OperationCanceled – if the progress reporter asked to stop. Raised only after post_serializing(), so whatever was processed before the cancellation is still written to the output file.
- read_dataset(dataset_to_process)¶
Read dataset and store into metadataset.
- Parameters:
dataset_to_process (
DatasetToProcess) – dataset path or URI to read- Return type:
- Returns:
dataset and metadataset, flagged as failed (processing_succeeded is False) if reading raised