geotrans.transform module

Description: Module in charge of all loading and saving.

geotrans.transform.check_file(filepath)

Check that filepath is valid and file is valid.

But will not check if it is a geodata file.

Return type

None

geotrans.transform.determine_filetype(filepath)

Take a single geodata filepath and determine its geodata type.

Return type

str

geotrans.transform.load_file(filepath)

Load a single geodata file.

Takes a single geodata filepath string, determines its type and returns a list of GeoDataFrames and a list of layer names that consist of all file data.

Return type

Tuple[List[GeoDataFrame], List[str]]

geotrans.transform.load_multilayer(filepath)

Use fiona to parse geopackage and filegeodatabase layers. Returns a list of GeoDataFrames and a list layer names.

Will also work on single layer files.

Return type

Tuple[List[GeoDataFrame], List[str]]

geotrans.transform.load_singlelayer(filepath, filetype)

Load a single layer from a geodata file.

Return type

Tuple[List[GeoDataFrame], List[str]]

geotrans.transform.save_files(geodataframes, layer_names, filenames, transform_to_type)

Save given geodataframes to given output files.

The user can save his geodata files with multiple different options. If a directory is given, the geodata files are saved to that directory with the acquired layer names. If a single filename is given all geodata is saved to that file and this option requires checking that the format can handle multiple layers i.e. if shapefile is the save option: it cannot handle multiple layers and an error is thrown.

Filenames is a list of Paths that have been checked to be valid. If user inputted no filenames: the filename will be made from layer name before this function.

Return type

None

geotrans.transform.validate_loaded_geodataframes(geodataframes, layer_names)

Validate geodataframes as they are loaded.

Some columns (namely FID) cause issues when saving to geopackage. Currently these columns are removed to remove the issue.