Now that we have the map layers, we'll want to set up appropriate symbols and renderers to draw the vector data onto the map. Let's start by defining a method called
setupRenderers(), which creates the renderers for our various map layers. Our first renderer will display the track layer, where we use a
QgsRuleBasedRendererV2 object to display the tracks in different ways depending on the type of track, whether or not the track is open, and whether it is bidirectional or can only be used in one direction. Here is the relevant code:
def setupRenderers(self): root_rule = QgsRuleBasedRendererV2.Rule(None) for track_type in (TRACK_TYPE_ROAD, TRACK_TYPE_WALKING, TRACK_TYPE_BIKE, TRACK_TYPE_HORSE): if track_type == TRACK_TYPE_ROAD: ...