import io


def load_cities(fp):
    """Load a list of cities and their latitude-longitude coordinates from a
    given file.
    """
    # Data format:
    # <city-state-country> <lat> <lng>
    # (NOTE: Latitude and longitude are assumed to be in degrees.)
    #
    # WASHINGTON-DC-US 38.904722 -77.016389
    #
    cities = []
    for loc, lat, lng in (line.strip().split() for line in io.open(fp)):
        lat, lng = float(lat), float(lng)
        cities.append((loc, (lat, lng)))
    return cities