def avg_values(buildings_buf, building_data, road):
    """
    Get some really simple statistics on a set of buildings
    given a road segment. Return average building height and
    average distance from the buildings to the road.
    """

    if not buildings_buf:
        return 0, 0

    avg_dist = 0
    avg_height = 0

    for bid in buildings_buf:
        avg_dist += building_data[bid]['geom'].distance(road)

        # Sometimes no data available in the dataset.
        if building_data[bid]['height'] is not None:
            avg_height += building_data[bid]['height']

    avg_dist /= len(buildings_buf)
    avg_height /= len(buildings_buf)

    return avg_dist, avg_height