Welcome to Isogeo - XLSX Exporter’s documentation!

Author

Isogeo

Source code

https://github.com/Isogeo/isogeotoxlsx/

Issues

https://github.com/Isogeo/isogeotoxlsx/issues

Updated: 2020-05-14

Indices and tables

Package modules

isogeotoxlsx

isogeotoxlsx package

This package is used to export Isogeo metadata into Excel workbooks using the Isogeo Python SDK and OpenPyXl.

Subpackages
isogeotoxlsx.i18n package
Submodules
isogeotoxlsx.i18n.english module

Matching table between Isogeo metadata model, the extended attributes for Excel output and columns titles in FRENCH.

isogeotoxlsx.i18n.french module

Matching table between Isogeo metadata model, the extended attributes for Excel output and columns titles in FRENCH.

isogeotoxlsx.matrix package
isogeotoxlsx.matrix.ColumnPattern

alias of isogeotoxlsx.matrix.Column

Submodules
isogeotoxlsx.matrix.attributes module

Matching table of Excel columns for Feature Attributes analisis.

isogeotoxlsx.matrix.raster module

Matching table between Isogeo metadata model and Excel columns for Isogeo to Office.

isogeotoxlsx.matrix.resource module

Matching table between Isogeo metadata model and Excel columns for Isogeo to Office.

isogeotoxlsx.matrix.service module

Matching table between Isogeo metadata model and Excel columns for Isogeo to Office.

isogeotoxlsx.matrix.vector module

Matching table between Isogeo metadata model and Excel columns for Isogeo to Office.

isogeotoxlsx.utils package
Submodules
isogeotoxlsx.utils.formatter module
class isogeotoxlsx.utils.formatter.Formatter(lang='FR', output_type='Excel')

Bases: object

Metadata formatter to avoid repeat operations on metadata during export in different formats.

Parameters
  • lang (str) – selected language

  • output_type (str) – name of output type to format for. Defaults to ‘Excel’

  • default_values (tuple) –

    values used to replace missing values. Structure:

    (

    str_for_missing_strings_and_integers, str_for_missing_dates

    )

conditions(md_cgus)

Render input metadata CGUs as a new list.

Parameters

md_cgus (list) – list of conditions extracted from an Isogeo metadata

Return type

list

Example

# make a search including conditions
search = isogeo.search(include=("conditions",))

# parse results
for md in search.results:
    # load metadata as object
    md = Metadata.clean_attributes(md)

    # format conditions
    cgus_out = formatter.conditions(md.conditions)
frequency_as_explicit_str(update_frequency_code)

Transform ‘updateFrequency’ code value as an explicit string. See: https://github.com/isogeo/export-xlsx-py/issues/8

Parameters

update_frequency_code (str) – update frequency as stored in Isogeo API

Returns

update frequency as explicit string.

Return type

str

Example

>>> print(frequency_as_explicit_str("P1D"))
>>> "Every 1 day(s)"
limitations(md_limitations)

Render input metadata limitations as a new list.

Parameters

md_limitations (dict) – input dictionary extracted from an Isogeo metadata

Return type

list

specifications(md_specifications)

Render input metadata specifications as a new list.

Parameters

md_specifications (dict) – input dictionary extracted from an Isogeo metadata

Return type

list

isogeotoxlsx.utils.stats module

Statistics Calculator. Perform statistics analisis.

Author: Isogeo

Python: 3.7.x Created: 14/08/2014

class isogeotoxlsx.utils.stats.Stats(lang='fr')

Bases: object

Perform statistics calculations and make Excel charts.

attributes(ws_attributes, all_attributes)

Perform feature attributes analisis and write results into the wanted worksheet.

Parameters
  • ws_attributes (Worksheet) – sheet of a Workbook to write analisis

  • all_attributes (list) – list of all feature attributes. It’s a list of dicts.

li_data_formats = []
li_dates_md_created = []
li_dates_md_modified = []
line_dates(ws, li_dates_md_created=None, li_dates_md_modified=None, cell_start_table='O1', cell_start_chart='S1')

Calculates metadata creation and modification dates repartition and add a Line chart to the wanted sheet of Workbook.

Parameters
  • ws (Worksheet) – sheet of a Workbook to write analisis

  • li_dates_md_created (list) – list of metadatas’creation dates. If not specified, the class attribute will be used instead.

  • li_dates_md_modified (list) – list of metadatas’modification dates. If not specified, the class attribute will be used instead.

  • cell_start_table (str) – cell of the sheet where to start writing table

  • cell_start_chart (str) – cell of the sheet where to start writing the chart

md_empty_fields = {}
md_tags_occurences = {}
md_types_repartition = {}
pie_formats(ws, li_formats=None, cell_start_table='A20', cell_start_chart='D20')

Calculates metadata formats repartition and add a Pie chart to the wanted sheet of Workbook.

Parameters
  • ws (Worksheet) – sheet of a Workbook to write analisis

  • li_formats (list) – list of all formats labels. If not specified, the class attribute will be used instaed

  • cell_start_table (str) – cell of the sheet where to start writing table

  • cell_start_chart (str) – cell of the sheet where to start writing the chart

pie_types(ws, types_counters=None, cell_start_table='A1', cell_start_chart='D1')

Calculates metadata types repartition and add a Pie chart to the wanted sheet of Workbook.

Parameters
  • ws (Worksheet) – sheet of a Workbook to write analisis

  • types_counters (dict) – dictionary of types/count. If not specified, the class attribute will be used instaed

  • cell_start_table (str) – cell of the sheet where to start writing table

  • cell_start_chart (str) – cell of the sheet where to start writing the chart

Submodules
isogeotoxlsx.isogeo2xlsx module

Get metadatas from Isogeo and store it into a Excel worksheet.

class isogeotoxlsx.isogeo2xlsx.Isogeo2xlsx(lang='FR', url_base_edit='', url_base_view='', **kwargs)

Bases: openpyxl.workbook.workbook.Workbook

Used to store Isogeo API results into an Excel worksheet (.xlsx)

Parameters
  • lang (str) – selected language for output

  • url_base_edit (str) – base url to format edit links (basically app.isogeo.com)

  • url_base_view (str) – base url to format view links (basically open.isogeo.com)

column_width(ws, columns)

Set the width of the columns of the passed worksheet.

Parameters
  • ws (Worksheet) – worksheet into write headers

  • columns (ColumnPattern) – column table

headers_writer(ws, columns)

Writes the headers from a columns ref table to a worksheet.

Parameters
  • ws (Worksheet) – worksheet into write headers

  • columns (ColumnPattern) – column table

launch_analisis()

Launches special analisis, using the stats submodule.

row_height(ws, from_row=2, height=35)

Set the height of the rows of the passed worksheet.

Parameters
  • ws (Worksheet) – worksheet into write headers

  • from_row (int) – row to start from. Default to ‘2’ = ignoring headers.

  • height (int) – fixed height to apply. Default to 35.

set_worksheets(auto=None, vector=1, raster=1, service=1, resource=1, dashboard=0, attributes=0, fillfull=0, inspire=0)

Adds new sheets depending on present metadata types in isogeo API search tags.

Parameters
  • auto (list) – typically auto=search_results.get(‘tags’).keys()

  • vector (bool) – add vector sheet

  • raster (bool) – add raster sheet

  • service (bool) – add service sheet

  • resource (bool) – add resource sheet

  • dashboard (bool) – add dashboard sheet

  • attributes (bool) – add attributes sheet - only if vector is True too

  • fillfull (bool) – add fillfull sheet

  • inspire (bool) – add inspire sheet

store_md_generic(md, ws, idx)

Exports generic metadata attributes into Excel worksheet with some dynamic adaptations based on metadata type.

Parameters
  • md (Metadata) – metadata object to export

  • ws (Worksheet) – Excel worksheet to store the exported info

  • idx (int) – row index in the worksheet

store_metadatas(metadata, share=None)

Write metadata into the worksheet.

Parameters
  • metadata (Metadata) – metadata object to write

  • share (Share) – share to use to build the OpenCatalog URL

styling_cells(ws, columns)

Applies the referenced style to the cells of a column.

Parameters
  • ws (Worksheet) – worksheet into write headers

  • columns (ColumnPattern) – column table

tunning_worksheets(excluded_sheets='dashboard')

Applies some adjustments to the sheets of the workbook: filters, frozen panels, print settings, etc.

Parameters

excluded_sheets (tuple) – sheets name to be excluded from the tunning.

isogeotoxlsx.isogeoFromxlsx module

Make Metadatas from Excel worksheet like those returned by Isogeo2xlsx.

class isogeotoxlsx.isogeoFromxlsx.IsogeoFromxlsx(file_path='', lang='fr')

Bases: object

Used to read Isogeo Metadata stored into an Excel worksheet (.xlsx)

Parameters
  • file_path (Path) – the path of xlsx file to read

  • lang (str) – selected language for input

build_event(event_date, kind)

Build an Event instance from a date as string

build_index_dict(work_sheet, ref_dict)

Build a dictionnary where keys are Metadata (isogeo-pysdk objet) attributes and values are conresponding column index

build_inspireTh(inspireTh_value)

Build a dict of INSPIRE themes from a string where each keyword label is delimited with ‘;’, where keys are theme label and keys are theme uuid into Isogeo database

build_keywords(keywords_value)

Build a list of Keyword instances from a string where each keyword label is delimited with ‘;’

build_list(text)

Build a list from a string where different values are separated by ‘;’

build_md_conditions(conditions_value)

Build a list of Conditions instances from a string where each condition is delimited with ‘;’ retrieving licenses in the list of Licenses previously loaded if the excel file contains a ‘Licenses’ work sheet

build_md_contacts(contacts_value)

Build a list of Contact instances from a string where each contact email is delimited with ‘;’ retrieving theme in the list of Contacts previously loaded if the excel file contains a ‘Contacts’ work sheet

build_md_limitations(limitations_value)

Build a list of Limitations instances from a string where each limitation is delimited with ‘;’ retrieving directives in the list of Directive previously loaded if the excel file contains a ‘Directives’ work sheet

build_md_spec(specs_value)

Build a list of Specifications instances from a string where each specification is delimited with ‘;’ retrieving specifications uuid in the list of Specifiactions previously loaded if the excel file contains a ‘Specifications’ work sheet

read_file()

Simple method to read the xlsx file’s content

retrieve_sub_ressources(sub_ressource)
retrieve_vector_metadatas()

Method to retrieve Isogeo vectors metadatas from appropriate sheet and store theme as isogeo-pysdk models objects into class attributes