o2g/osm/handlers/relation_handler.py
def relation(self, rel):
        """Process each relation."""
        rel_type = rel.tags.get('type')
        if any([rel.deleted,
                not rel.visible,
                not self.is_new_version(rel),
                rel_type not in ['route', 'public_transport']]):
            return

        route_tag = rel.tags.get('route')
        if rel_type == 'route' and route_tag not in self.transit_route_types:
            return

        public_transport = rel.tags.get('public_transport')
        if rel_type == 'public_transport' and public_transport != 'stop_area':
            return

        self.relations[rel.id] = \
            Relation(rel.id, {
                'type': rel_type,
                'public_transport': public_transport,
                'route': route_tag,
                'operator': rel.tags.get('operator'),
                'color': rel.tags.get('color'),
                'ref': rel.tags.get('ref'),
                'from': rel.tags.get('from'),
                'to': rel.tags.get('to'),
                'name': rel.tags.get('name'),
                'alt_name': rel.tags.get('alt_name'),
                'url': rel.tags.get('url'),
                'contact_website': rel.tags.get('contact:website')},
                [(member.type, member.ref, member.role) for member in rel.members])

        self.versions[rel.id] = rel.version
def relation(self, rel):
        """Process each relation."""
        rel_type = rel.tags.get('type')
        if any([rel.deleted,
                not rel.visible,
                not self.is_new_version(rel),
                rel_type not in ['route', 'public_transport']]):
            return

        route_tag = rel.tags.get('route')
        if rel_type == 'route' and route_tag not in self.transit_route_types:
            return

        public_transport = rel.tags.get('public_transport')
        if rel_type == 'public_transport' and public_transport != 'stop_area':
            return

        self.relations[rel.id] = \
            Relation(rel.id, {
                'type': rel_type,
                'public_transport': public_transport,
                'route': route_tag,
                'operator': rel.tags.get('operator'),
                'color': rel.tags.get('color'),
                'ref': rel.tags.get('ref'),
                'from': rel.tags.get('from'),
                'to': rel.tags.get('to'),
                'name': rel.tags.get('name'),
                'alt_name': rel.tags.get('alt_name'),
                'url': rel.tags.get('url'),
                'contact_website': rel.tags.get('contact:website')},
                [(member.type, member.ref, member.role) for member in rel.members])

        self.versions[rel.id] = rel.version
Process each relation.