o2g/osm/builders/stop_builder.py
def extract_stops(relation, nodes, visited_stop_ids, stop_to_station_map):
    """Extract stops in a relation."""
    # member_role: stop, halt, platform, terminal, etc.
    for member_type, member_id, member_role in relation.member_info:

        if member_id not in visited_stop_ids and \
            member_id in nodes and\
                member_role in ('stop', 'halt'):

            location_type = ''

            visited_stop_ids.add(member_id)
            yield Stop(
                member_id,
                nodes[member_id].tags.get('name') or
                "Unnamed {} stop.".format(relation.tags.get('route')),
                nodes[member_id].lon if member_id in nodes else '',
                nodes[member_id].lat if member_id in nodes else '',
                relation.id,
                _map_wheelchair(nodes[member_id].tags.get('wheelchair')),
                location_type,
                stop_to_station_map.get(member_id, ''))
def extract_stops(relation, nodes, visited_stop_ids, stop_to_station_map):
    """Extract stops in a relation."""
    # member_role: stop, halt, platform, terminal, etc.
    for member_type, member_id, member_role in relation.member_info:

        if member_id not in visited_stop_ids and \
            member_id in nodes and\
                member_role in ('stop', 'halt'):

            location_type = ''

            visited_stop_ids.add(member_id)
            yield Stop(
                member_id,
                nodes[member_id].tags.get('name') or
                "Unnamed {} stop.".format(relation.tags.get('route')),
                nodes[member_id].lon if member_id in nodes else '',
                nodes[member_id].lat if member_id in nodes else '',
                relation.id,
                _map_wheelchair(nodes[member_id].tags.get('wheelchair')),
                location_type,
                stop_to_station_map.get(member_id, ''))
Extract stops in a relation.