Example #1
0
def getCoordinatesForAllData(sourceUrl, patternUrl):

    data = EventsPortal.getAllEventsData(sourceUrl, patternUrl)

    for docs in data:
        latitudeField = docs['latitude']

        if latitudeField == None:

            geocity = docs['locationCity']

            geolocator = Nominatim()
            locatorCity = geocity

            location = geolocator.geocode(locatorCity)

            latitude = location.latitude

            longitude = location.longitude

            docs['latitudetest'] = latitude

            docs['longitudetest'] = longitude

        else:
            pass

    return data
def getCoordinatesForAllData(sourceUrl,patternUrl):

    data = EventsPortal.getAllEventsData(sourceUrl,patternUrl)


    for docs in data:
        latitudeField = docs['latitude']

        if latitudeField == None:

            geocity = docs['locationCity']

            geolocator = Nominatim()
            locatorCity = geocity

            location = geolocator.geocode(locatorCity)

            latitude = location.latitude

            longitude = location.longitude

            docs['latitudetest'] = latitude

            docs['longitudetest'] = longitude

        else:
            pass

    return  data