![]() |
GNSS data to OSM format processor and track finder
author: Jaroslav Pizur
|
Functions in this file are primarily focused on the solution of input data normalisation (getting input GNSS data enriched by the OSM format). More...
Functions | |
| def | feats (basedata) |
| def | coords (basedata_features) |
| def | del_special_elem (basedata) |
| def | del_unique_nodes (basedata, uniq_nodes) |
| Function takes a list of nodes (uniq_nodes) and removes them from the dictionary basedata. More... | |
| def | del_special_elem2 (clist) |
| Function deletes those items from a list, which are equal to the defined element. More... | |
| def | del_duplicates (alist) |
| Function gets rid or duplicates in the input list not regarding its position (whether it is sequential duplicate). More... | |
| def | coords_to_latlon (coords, empty_lat, empty_lon) |
| Function takes coords and assigns individual coordinate parts to empty_lat and empty_lon correspondingly. More... | |
| def | cut_unnecessary_xroads (nodes, chosen) |
| Function purpose is to mark with [-1, -1] specific elements in the nodes. More... | |
| def | filter_base (basedata, chosen_nodes) |
| Function purpose is to leave only those nodes in the basemap, which are equal to chosen_nodes. More... | |
| def | get_unique_nodes (nodes) |
| Function takes one list of nodes. More... | |
| def | get_fine_indata (basedata, chosen_nodes) |
| counterlist keeps the information about how many chosen_nodes there is in the particular feature. More... | |
| def | get_nodes_duplicates (coords, nodes, smxd, nmxd, slcd) |
| By the speed of the input data source, script selects Normal Movement Crossroad Distance (nmxd) or Slow Movement Crossroad Distance (smxd). More... | |
Functions in this file are primarily focused on the solution of input data normalisation (getting input GNSS data enriched by the OSM format).
| def xroad_functions.coords | ( | basedata_features | ) |
| def xroad_functions.coords_to_latlon | ( | coords, | |
| empty_lat, | |||
| empty_lon | |||
| ) |
Function takes coords and assigns individual coordinate parts to empty_lat and empty_lon correspondingly.
| coords | list of coordinate nodes which comprise of latitudes and longitudes (in a form of a list) |
| empty_lat | list of numbers which represent coordinate latitudes |
| empty_lon | list of numbers which represent coordinate longitudes |
| def xroad_functions.cut_unnecessary_xroads | ( | nodes, | |
| chosen | |||
| ) |
Function purpose is to mark with [-1, -1] specific elements in the nodes.
If an element from nodes is not equal to any chosen of the chosen nodes, them it is marked by [-1, -1] which indicates that it will be deleted. As soon as it finds the equality, the process continues from the other side of the nodes list and the former process is immediately stopped.
| nodes | list of nodes in which we want to mark specific ones |
| chosen | list of nodes which will determine which items will be marked in the nodes list (logic is explained above) |
| def xroad_functions.del_duplicates | ( | alist | ) |
Function gets rid or duplicates in the input list not regarding its position (whether it is sequential duplicate).
| def xroad_functions.del_special_elem | ( | basedata | ) |
Function removes all defined (special) elements in the nested list. Argument has to be a dictionary and the nested list is under features -> geometry -> coordinates. Function changes the given memory section defined by the parameter => no return.
| basedata | type dictionary and has to satisfy used case-specific geojson format OSM |
| def xroad_functions.del_special_elem2 | ( | clist | ) |
Function deletes those items from a list, which are equal to the defined element.
In this case: [-1,-1]
| def xroad_functions.del_unique_nodes | ( | basedata, | |
| uniq_nodes | |||
| ) |
Function takes a list of nodes (uniq_nodes) and removes them from the dictionary basedata.
| basedata | type dictionary and has to satisfy used case-specific geojson format OSM |
| uniq_nodes | list of nodes to remove from basedata |
| def xroad_functions.feats | ( | basedata | ) |
| def xroad_functions.filter_base | ( | basedata, | |
| chosen_nodes | |||
| ) |
Function purpose is to leave only those nodes in the basemap, which are equal to chosen_nodes.
| basedata | type dictionary and has to satisfy used case-specific geojson format |
| chosen_nodes | list of nodes which we want in the basemap and all other we want deleted |
| def xroad_functions.get_fine_indata | ( | basedata, | |
| chosen_nodes | |||
| ) |
counterlist keeps the information about how many chosen_nodes there is in the particular feature.
If there is less than 2, they will be marked and deleted. If 2 and more, (more than 1), there will be special filter applied described in the xroad_functions.py: cut_unnecessary_xroads which further reduce the nodes.
| basedata | requires the fine representation - not Xroad - it would not make sense |
| chosen_nodes | list of border nodes. At the end we want to keep all the basedata nodes in between chosen_nodes. |
| def xroad_functions.get_nodes_duplicates | ( | coords, | |
| nodes, | |||
| smxd, | |||
| nmxd, | |||
| slcd | |||
| ) |
By the speed of the input data source, script selects Normal Movement Crossroad Distance (nmxd) or Slow Movement Crossroad Distance (smxd).
Speed of the input data source is determined by the current distance between the newest node and the previous one. Remember these variables. Then function calculates the distance between each input coordinate and xroadnode. For each distance defined as such: if the distance is less than sooner defined Slow Movement Crossroad Distance or Normal Movement Crossroad Distance, then append this xroadnode to nodes_duplicates. It will have duplicates as expected.
| coords | list of input data nodes [[lon1,lat1],[lon2,lat2],...]
@param nodes nodes of "basemap"
@param smxd Slow Movement Crossroad Distance
|
| nmxd | Normal Movement Crossroad Distance testing the distance between xroad node and a coordinate while the distance between current and the previous coordinate is bigger than the "Last Coordinate Distance" |
| slcd | Set Last Coordinate Distance testing the distance between current and the last coordinate node from input file |
| def xroad_functions.get_unique_nodes | ( | nodes | ) |
Function takes one list of nodes.
While it goes through itself, it is not changing itself. Just checks for uniqueness of elements. Into separate list only appends those, that are unique.
| nodes | list of nodes to get unique nodes from |