dicogis.export.to_xlsx module

class dicogis.export.to_xlsx.MetadatasetSerializerXlsx(localized_strings=None, output_path=None, opt_raw_path=False, opt_size_prettify=True)

Bases: MetadatasetSerializerBase

Export into a XLSX worksheet.

__init__(localized_strings=None, output_path=None, opt_raw_path=False, opt_size_prettify=True)

Store metadata into Excel worksheets.

Parameters:
  • texts (dict, optional) – dictionary of translated texts. Defaults to {}.

  • opt_size_prettify (bool, optional) – option to prettify size or not. Defaults to False.

Format a cell hyperlink with a target and a label.

Parameters:
  • target (Union[str, Path]) – link destination

  • label (str) – display text

Returns:

cell text formatted with hyperlink

Return type:

str

format_bbox(bbox)

Format bounding-box tuple to fit Excel constraints.

Parameters:

bbox (tuple[float, float, float, float] | None) – input bounding-box tuple

Return type:

str

Returns:

formatted bbox as Excel-compliant string

format_feature_attributes(metadataset)

Format vector feature attributes in an unique string.

Parameters:

metadataset (MetaDataset) – metadataset

Returns:

concatenated string with feature attributes informations

Return type:

str

format_size(in_size_in_octets=0)

Format size in octets accordingly to the option.

Parameters:

in_size_in_octets (int) – input size in octets

Returns:

formatted size in octets

Return type:

str

get_sheet_and_incremented_row_index_from_type(metadataset)

Helper method to get the worksheet and row index corresponding to a type of metadataset.

Parameters:

metadataset (MetaDataset) – input metadataset

Return type:

tuple[Worksheet, int]

Returns:

worksheet, row index

is_style_registered(style_name)

Function to check if a named style already exists/

Parameters:

style_name (str) – name of style to check

Return type:

bool

Returns:

True if a style with the same name already exist in the worksheet

li_cols_filedb = ['nomfic', 'path', 'theme', 'tot_size', 'date_crea', 'date_actu', 'format', 'feats_class', 'num_attrib', 'num_objets', 'geometrie', 'srs', 'srs_type', 'codepsg', 'emprise', 'li_chps']
li_cols_mapdocs = ['nomfic', 'path', 'theme', 'custom_title', 'creator_prod', 'keywords', 'subject', 'res_image', 'tot_size', 'date_crea', 'date_actu', 'origin_x', 'origin_y', 'srs', 'srs_type', 'codepsg', 'sub_layers', 'num_attrib', 'num_objets', 'li_chps']
li_cols_raster = ['nomfic', 'path', 'theme', 'size_Y', 'size_X', 'pixel_w', 'pixel_h', 'origin_x', 'origin_y', 'srs', 'srs_type', 'codepsg', 'emprise', 'date_crea', 'date_actu', 'num_bands', 'format', 'compression', 'coloref', 'li_depends', 'tot_size', 'gdal_warn']
li_cols_sgbd = ['nomfic', 'conn_chain', 'schema', 'num_attrib', 'num_objets', 'geometrie', 'srs', 'srs_type', 'codepsg', 'emprise', 'format', 'li_chps', 'gdal_err']
li_cols_vector = ['nomfic', 'path', 'theme', 'num_attrib', 'num_objets', 'geometrie', 'srs', 'srs_type', 'codepsg', 'emprise', 'date_crea', 'date_actu', 'format', 'li_depends', 'tot_size', 'li_chps', 'gdal_warn']
post_serializing()

Run post serialization steps.

pre_serializing(has_vector=False, has_raster=False, has_filedb=False, has_mapdocs=False, has_cad=False, has_sgbd=False)

Prepare workbooks.

Parameters:
  • has_vector (bool, optional) – _description_. Defaults to False.

  • has_raster (bool, optional) – _description_. Defaults to False.

  • has_filedb (bool, optional) – _description_. Defaults to False.

  • has_mapdocs (bool, optional) – _description_. Defaults to False.

  • has_cad (bool, optional) – _description_. Defaults to False.

  • has_sgbd (bool, optional) – _description_. Defaults to False.

serialize_metadaset(metadataset)

Router method to serialize metadataset depending on its type.

Parameters:

metadataset (MetaDataset) – metadaset object to serialize

Returns:

True if the object has been correctly serialized

Return type:

bool

store_error(metadataset, worksheet, row_index)

Helper to store processing error in worksheet’s row.

Parameters:
  • metadataset (MetaDataset) – metadata with processing error

  • worksheet (Worksheet) – Excel workbook’s sheet where to store

  • row_index (int) – worksheet’s row index

store_md_flat_geodatabases(metadataset, worksheet=None, row_index=None)

Serialize a metadataset into an Excel worksheet’s row.

Parameters:
  • metadataset (MetaDatabaseTable) – metadataset to serialize

  • worksheet (Workbook | None, optional) – Excel workbook’s sheet where to store. Defaults to None.

  • row_index (int | None, optional) – worksheet’s row index. Defaults to None.

store_md_geodatabases_server(metadataset, worksheet=None, row_index=None)

Serialize a metadataset into an Excel worksheet’s row.

Parameters:
  • metadataset (MetaDatabaseTable) – metadataset to serialize

  • worksheet (Workbook | None, optional) – Excel workbook’s sheet where to store. Defaults to None.

  • row_index (int | None, optional) – worksheet’s row index. Defaults to None.

store_md_mapdoc(metadataset, worksheet=None, row_index=None)

Serialize a metadataset into an Excel worksheet’s row.

Parameters:
  • metadataset (MetaDatabaseTable) – metadataset to serialize

  • worksheet (Workbook | None, optional) – Excel workbook’s sheet where to store. Defaults to None.

  • row_index (int | None, optional) – worksheet’s row index. Defaults to None.

store_md_raster_files(metadataset, worksheet=None, row_index=None)

Serialize a raster metadataset into an Excel worksheet’s row.

Parameters:
  • metadataset (MetaDatabaseTable) – metadataset to serialize

  • worksheet (Workbook | None, optional) – Excel workbook’s sheet where to store. Defaults to None.

  • row_index (int | None, optional) – worksheet’s row index. Defaults to None.

store_md_vector_files(metadataset, worksheet=None, row_index=None)

Serialize a vector metadataset into an Excel worksheet’s row.

Parameters:
  • metadataset (MetaDatabaseTable) – metadataset to serialize

  • worksheet (Workbook | None, optional) – Excel workbook’s sheet where to store. Defaults to None.

  • row_index (int | None, optional) – worksheet’s row index. Defaults to None.

tunning_workbook()

Clean up and tunning worksheet.