Esempio n. 1
0
def find_matching_states(places_to_geocode, city_to_match):
    """Create a list of each state we found a geocoder result matching our city."""
    geocoding_results = [geocode_address(place) for place in places_to_geocode]

    matching_states = []
    for result in geocoding_results:
        _geocode_had_matching_state = (
            result is not None and
            result.city == city_to_match)
        if _geocode_had_matching_state:
            matching_states.append(result.state)
    return matching_states