polaris.network.ie.import_export.ImportExport#

class polaris.network.ie.import_export.ImportExport(supply_database_path: PathLike)#

Bases: object

This class allows for importing and exporting to the GMNS format.

__init__(supply_database_path: PathLike)#

Methods

__init__(supply_database_path)

dump(folder_name[, tables, ...])

Creates a folder and dumps all tables in the database to CSV files

from_gmns(gmns_folder, crs)

Imports the network data from the GMNS format

restore(folder_name[, jumpstart])

Reloads the network from a previous dump to csv

to_gmns(gmns_folder, crs)

Exports the network data to the GMNS format

__init__(supply_database_path: PathLike)#
dump(folder_name: str, tables=None, include_patterns=None, target_crs=None, extension='csv') None#

Creates a folder and dumps all tables in the database to CSV files

Args:

folder_name (str): Folder where the dump files are to be placed

tables (list, Optional): List of tables to be dumped. If None, all tables are dumped. Defaults to None

include_patterns (list, Optional): List of table name patterns to be dumped. If None, no patterns will be enforced. Defaults to None. Cannot be provided when providing a list of tables to dump

target_crs (int, Optional): The desired CRS for the dumped files. If None, the original CRS is used. Defaults to None

extension (str, Optional): The extension of the dumped files. Defaults to ‘csv’. The preferred alternative is “parquet”

restore(folder_name: PathLike, jumpstart=False) None#

Reloads the network from a previous dump to csv

Args:

folder_name (str): Folder where the dump files are located jumpstart (bool): Copies base sql already initialized with spatialite base tables. It saves about

a minute of runtime.

from_gmns(gmns_folder: str, crs: str)#

Imports the network data from the GMNS format

Args:

gmns_folder (str): Folder where the GMNS files are located crs (str): CRS of the exported dataset in readable format by PyProj (e.g. ‘epsg:4326’)

to_gmns(gmns_folder: str, crs: str)#

Exports the network data to the GMNS format

Args:

gmns_folder (str): Folder where the GMNS files are to be placed crs (str): CRS of the exported dataset in readable format by PyProj (e.g. ‘epsg:4326’)