Package sabx10 :: Package osm :: Module osm
[hide private]
[frames] | no frames]

Module osm

source code

Create the template data and process the templates so that OSM format XML files can be generated. These files will later be processed by Mapnik into PDF files containing ride maps.

Classes [hide private]
  SabxProcessor
Specialized TemplateProcessor to handle SABX files and turn them into map data that Mapnik can handle.
Functions [hide private]
 
_process_segments(ride)
Go through all the segments for the ride and add way ids.
source code
 
_process_turns(ride, node_id)
Go through all the turns for the ride and add node ids.
source code
list of Cluster
_find_clustered_turns(turns, dist)
Find clusters of turns that are within "dist" distance of eachother.
source code
 
_size_cluster_bounding_boxes(clusters, dist)
Enlarge and set the pixel size for the Cluster boxes.
source code
list of Cluster
_get_turn_clusters(turns, dist)
Generate and size the clusters for a list of turns.
source code
 
_process_stops_pois(items, node_id)
Go through a list of stops or pois, filter out duplicates, and add node ids to them.
source code
 
_process_parking(ride, node_id)
Update the parking for a ride by adding a node id.
source code
 
_process_zooms_n_clusters(the_ride, node_id)
Go through the given ride and generate turn clusters and lists of zoomed-in and zommed-out turns, stops, and pois.
source code
 
_process_all_rides(xml_tree, title, node_id)
Go through all the rides in the rideset and generate the data needed by the template to create the PDF map data.
source code
Variables [hide private]
  __package__ = 'sabx10.osm'
Function Details [hide private]

_process_segments(ride)

source code 

Go through all the segments for the ride and add way ids. This is necessary because the OSM way elements are generated from SABX segments and must have unique ids.

Parameters:
  • ride (Ride) - Ride whose segments will be modified

_process_turns(ride, node_id)

source code 

Go through all the turns for the ride and add node ids. This is necessary because some OSM node elements are generated from SABX turns and must have unique ids. Also, add a name to the turn because all nodes are expected to have names.

Parameters:
  • ride (Ride) - Ride whose turns will be modified
  • node_id (NodeId) - NodeId to generate turn node ids from

_find_clustered_turns(turns, dist)

source code 

Find clusters of turns that are within "dist" distance of eachother. Clusters are used to create smaller maps of turns whose icons would overlap on the large map and be hard to distinguish. These are like insets on some maps used to show highly detailed areas of interest.

Parameters:
  • turns (list of Turn) - list of Turns to process
  • dist (float) - distance threshold for determining clusters
Returns: list of Cluster
list of Cluster

_size_cluster_bounding_boxes(clusters, dist)

source code 

Enlarge and set the pixel size for the Cluster boxes.

Parameters:
  • clusters (list of Cluster) - list of Clusters to process
  • dist (float) - distance threshold for determining clusters

_get_turn_clusters(turns, dist)

source code 

Generate and size the clusters for a list of turns.

Parameters:
  • turns (list of Turn) - list of Turns to process
  • dist (float) - distance threshold for determining clusters
Returns: list of Cluster
list of Cluster

_process_stops_pois(items, node_id)

source code 

Go through a list of stops or pois, filter out duplicates, and add node ids to them.

Adding node ids is necessary because some OSM node elements are generated from SABX stops and pois and must have unique ids.

Filtering out duplicates is necessary because some stops and pois can be visited more than once in a ride if a ride passes through the same place twice (or more). For the map, the stop or poi icon should only be displayed once.

Parameters:

_process_parking(ride, node_id)

source code 

Update the parking for a ride by adding a node id. This is necessary because some OSM node elements are generated from SABX parking elements and must have unique ids.

Parameters:
  • ride (Ride) - Ride whose parking will be modified
  • node_id (NodeId) - NodeId to generate the parking node id from

_process_zooms_n_clusters(the_ride, node_id)

source code 

Go through the given ride and generate turn clusters and lists of zoomed-in and zommed-out turns, stops, and pois.

Parameters:

_process_all_rides(xml_tree, title, node_id)

source code 

Go through all the rides in the rideset and generate the data needed by the template to create the PDF map data.

Parameters:
  • xml_tree (ElementTree stuff) - ElementTree representation of a rideset
  • title (string) - title for the map
  • node_id (NodeId) - NodeId to generate the node ids from