| GNSS data to OSM format processor and track finder

- Main Page
- Packages
- Files

- Packages
- Package Functions

Functions
refactor_functions Namespace Reference

Functions created with the goal to refactor the code, make it more readable and understandable. More...

## Functions
def | json_file_dumper (variable_name, filepath)
| Function takes the name of a variable that is needed to be saved and saves it to the filepath location. More...
def | json_file_loader (filepath)
| Function looks for the file located on given filepath and returns the found data. More...
def | load_input_file (input_file_path)
| Function reads the input_file_path as csv, searching for latitudes and longitudes, zips them together, gets rid of NaNs and returns coordinates. More...
def | load_dependencies ()
| Purpose of this function is to load basemap dependencies. More...
def | get_input_crossroad_representation (coords_input, nodes_map_crossroad, basemap_crossroads)
| This functions' purpose is to provide crossroad representation in nodes format as well as OSM format. More...
def | get_input_fine_representation (basemap_without_points, nodes_input_crossroad, coords_input)
| This functions' purpose is to provide fine representation in nodes format as well as OSM format. More...
def | track_identification_dependencies (coords_input, nodes_input_fine)
| Here all the data previously acquisited are restructured to provide what will be needed for the track finding algorithms. More...
def | save_files (files_dict, parent_path)
| Saves all files in the dictionary to a folder given by the input argument parent_path. More...
def | delete_files (files_dict, parent_path)
| Opposite funtionality when compared to save_files function. More...
def | get_basemap_track (basemap_input_fine, nodes_track)
| Returns an OSM format file which contains only nodes that are part of nodes_track. More...
def | get_basemap_tracks (basemap_in, nodes_1, nodes_2)
| Returns get_basemap_track output for 2 input node tracks. More...
def | verification_nodes (script_output_nodes, nodes_map_crossroad, basemap_crossroads, basemap_without_points)
| Function tests the trackfinding method. More...

## Detailed Description

Functions created with the goal to refactor the code, make it more readable and understandable.

## Function Documentation

## ◆ delete_files()

def refactor_functions.delete_files | ( |  | files_dict,
|  |  | parent_path
| ) |  |

Opposite funtionality when compared to save_files function.

Function deletes all the files given in the dictionary keys from the given parent folder.

## ◆ get_basemap_track()

def refactor_functions.get_basemap_track | ( |  | basemap_input_fine,
|  |  | nodes_track
| ) |  |

Returns an OSM format file which contains only nodes that are part of nodes_track.

## ◆ get_basemap_tracks()

def refactor_functions.get_basemap_tracks | ( |  | basemap_in,
|  |  | nodes_1,
|  |  | nodes_2
| ) |  |

Returns get_basemap_track output for 2 input node tracks.

## ◆ get_input_crossroad_representation()

def refactor_functions.get_input_crossroad_representation | ( |  | coords_input,
|  |  | nodes_map_crossroad,
|  |  | basemap_crossroads
| ) |  |

This functions' purpose is to provide crossroad representation in nodes format as well as OSM format.

All input represented, so the input GNSS data are represented in crossroads this way.

Parameters

  coords_input | GNSS data input in coordinate form (zipped latitudes and longitudes)
  nodes_map_crossroad | map of crossroad in nodes format
  basemap_crossroads | map of crossroads in OSM format (geojson)

Returns
  dictionary with both expected results; node and OSM form of input in crossroad representation

## ◆ get_input_fine_representation()

def refactor_functions.get_input_fine_representation | ( |  | basemap_without_points,
|  |  | nodes_input_crossroad,
|  |  | coords_input
| ) |  |

This functions' purpose is to provide fine representation in nodes format as well as OSM format.

All input represented. The input and result is simmilar to get_input_crossroad_representation function. The only difference is that the actual body parforms different tasks and this function needs an output from the previously mentioned function.

Parameters

  basemap_without_points | former basemap, filtered only from not needed features
  nodes_input_crossroad | input in nodes form and represented in crossroads
  coords_input | GNSS data input in coordinate form (zipped latitudes and longitudes)

Returns
  dictionary with both expected results; node and OSM form of input in fine representation

## ◆ json_file_dumper()

def refactor_functions.json_file_dumper | ( |  | variable_name,
|  |  | filepath
| ) |  |

Function takes the name of a variable that is needed to be saved and saves it to the filepath location.

## ◆ json_file_loader()

def refactor_functions.json_file_loader | ( |  | filepath | ) |

Function looks for the file located on given filepath and returns the found data.

## ◆ load_dependencies()

def refactor_functions.load_dependencies | ( |  | ) |

Purpose of this function is to load basemap dependencies.

Basemap creator is part of the process that is needed, but is not obligatory to run every time. So the process is separated, but the outputs are still neded, o they are loaded this way.

## ◆ load_input_file()

def refactor_functions.load_input_file | ( |  | input_file_path | ) |

Function reads the input_file_path as csv, searching for latitudes and longitudes, zips them together, gets rid of NaNs and returns coordinates.

## ◆ save_files()

def refactor_functions.save_files | ( |  | files_dict,
|  |  | parent_path
| ) |  |

Saves all files in the dictionary to a folder given by the input argument parent_path.

Names of the newly saved files will be given by the key value they have in the dictionary.

## ◆ track_identification_dependencies()

def refactor_functions.track_identification_dependencies | ( |  | coords_input,
|  |  | nodes_input_fine
| ) |  |

Here all the data previously acquisited are restructured to provide what will be needed for the track finding algorithms.

At this point the successtion is needed to identify bus lines. Data filtering occurs in a form of running get_nodes_duplicates function which will help to detect crucial nodes. Then the repetitions are deleted and resulting sequence is prepared.

Parameters

  coords_input | GNSS data input in coordinate form (zipped latitudes and longitudes)
  nodes_input_fine | serves as a basemap for get_nodes_duplicates algorithm

Returns
  dictionary with three crucial ouputs;

tupled_nodes_input_fine_succession which is the succession expressed in tuples

nodes_minimum is the input parameter for trackfinding algorithms, it took the input expected seconds that the found bus line should have and trasfered it into nodes; so the track finding algorithm works every time with nodes

nodes_maximum the same as nodes_minimum, but espressing the upper boundary

## ◆ verification_nodes()

def refactor_functions.verification_nodes | ( |  | script_output_nodes,
|  |  | nodes_map_crossroad,
|  |  | basemap_crossroads,
|  |  | basemap_without_points
| ) |  |

Function tests the trackfinding method.

c.INPUT_VERIF file in the body of this function represents the input trajectory of a sole bus line. It is normalized and got rid of duplicates. Then there is a bus line found by our algorithm and trackfinding method. There is an intersection found and is compared with the total number of nodes either in the normalized input or our found track. It is always compared the the bigger number to always get the worst number possible so it is possible to test the quality appropriately.

Parameters

  script_output_nodes | bus line identified by the algorithm
  nodes_map_crossroad | nodes of the whole basemap
  basemap_crossroads | OSM format containing only crossroads
  basemap_without_points | OSM format basemap fine representation

Returns
  ratio in the range 0-100 to express the quality of the trackfinding methods and approaches