GNSS data to OSM format processor and track finder
Functions
xroad_functions Namespace Reference

Functions in this file are primarily focused on the solution of input data normalisation (getting input GNSS data enriched by the OSM format as well as changing their coordinates according to the most probable coordinates situated nerby belonging to the OSM system). More...

Functions

def feats (basedata)
 Features getting simplification. More...
 
def coords (basedata_features)
 Coordinates getting simplification. More...
 
def del_special_elem (basedata)
 Function removes all defined (special) elements in the nested list. More...
 
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 of 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...
 

Detailed Description

Functions in this file are primarily focused on the solution of input data normalisation (getting input GNSS data enriched by the OSM format as well as changing their coordinates according to the most probable coordinates situated nerby belonging to the OSM system).

Function Documentation

◆ coords()

def xroad_functions.coords (   basedata_features)

Coordinates getting simplification.

◆ coords_to_latlon()

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.

Parameters
coordslist of coordinate nodes which comprise of latitudes and longitudes (in a form of a list)
empty_latlist of numbers which represent coordinate latitudes
empty_lonlist of numbers which represent coordinate longitudes

◆ cut_unnecessary_xroads()

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 particular 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.

Parameters
nodeslist of nodes in which we want to mark specific ones
chosenlist of nodes which will determine which items will be marked in the nodes list (logic is explained above)

◆ del_duplicates()

def xroad_functions.del_duplicates (   alist)

Function gets rid of duplicates in the input list not regarding its position (whether it is sequential duplicate).

◆ del_special_elem()

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.

Parameters
basedatatype dictionary and has to satisfy used case-specific geojson format OSM

◆ del_special_elem2()

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]

◆ del_unique_nodes()

def xroad_functions.del_unique_nodes (   basedata,
  uniq_nodes 
)

Function takes a list of nodes (uniq_nodes) and removes them from the dictionary basedata.

Parameters
basedatatype dictionary and has to satisfy used case-specific geojson format OSM
uniq_nodeslist of nodes to remove from basedata

◆ feats()

def xroad_functions.feats (   basedata)

Features getting simplification.

◆ filter_base()

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.

Deep copy is created which is returned at the end of the function.

Parameters
basedatatype dictionary and has to satisfy used case-specific geojson format (OSM)
chosen_nodeslist of nodes which we want in the basemap and all other we want deleted

◆ get_fine_indata()

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.

Parameters
basedatarequires the fine representation - not Xroad - it would not make sense
chosen_nodeslist of border nodes. At the end we want to keep all the basedata nodes in-between chosen_nodes.

◆ get_nodes_duplicates()

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.

Parameters
coordslist of input data nodes [[lon1,lat1],[lon2,lat2],...]
nodesnodes of "basemap"
smxdSlow Movement Crossroad Distance testing the distance between xroad node and a coordinate while the distance between current and the previous coordinate is smaller than the "lastCoordinateDistance"
nmxdNormal 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"
slcdSet Last Coordinate Distance testing the distance between current and the last coordinate node from input file

◆ get_unique_nodes()

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. This new one will be returned.

Parameters
nodeslist of nodes to get unique nodes from