dicogis.export.base_serializer module¶
- class dicogis.export.base_serializer.MetadatasetSerializerBase(localized_strings=None, output_path=None, opt_raw_path=False, opt_size_prettify=True)¶
Bases:
objectBase class for metadataset serializers.
- __init__(localized_strings=None, output_path=None, opt_raw_path=False, opt_size_prettify=True)¶
Initialize object.
- classmethod get_serializer_from_parameters(format_or_serializer, output_path=None, opt_raw_path=False, opt_prettify_size=True, localized_strings=None, language=None, opt_include_original_path=None, catalog_record_settings=None)¶
Initiate the adequat serializer depending on parameters.
- Parameters:
format_or_serializer (str | OutputFormats.excel | OutputFormats.json | OutputFormats.udata | OutputFormats.iso19139 | MetadatasetSerializerBase) – output format or serializer
output_path (Path | None) – output path
opt_raw_path (bool) – option to serialize dataset raw path without any sugar syntax
opt_prettify_size (bool) – option to prettify size in octets (typically: 1 ko instead of 1024 octects)
localized_strings (dict | None) – localized texts. Defaults to None.
language (str | tuple | None) – language of the metadata records (iso19139). Defaults to None, which means English.
opt_include_original_path (bool | None) – publish the location of the datasets in the metadata records (iso19139). Defaults to the DICOGIS_ISO_INCLUDE_ORIGINAL_PATH environment variable.
catalog_record_settings (CatalogRecordSettings | None) – settings of the metadata records (iso19139), built by the caller. Replaces language and opt_include_original_path, and the environment variables.
- Return type:
MetadatasetSerializerBase
- Returns:
serializer already initialized
- unique_output_filename(dataset_name, extension)¶
Pick the name of a per-dataset output file, unique within this run.
Datasets are often homonyms (lines.shp in several folders): suffixed with a counter rather than overwriting the one written before.