Location of Villages?

I’m working on the Viz aspect of the challenge. I haven’t been able to find a few of the villages on Google Maps (or other mapping applications). Is it possible to get the gps coordinates of the 10 villages listed in the dataset?

@rudolph - great question, we’ll try to track this down.

In the meantime, for the ones which Google Maps does know about (not all of them), here’s a great way to grab lat/longs using the googlemaps Python library. (Corresponding R explanation here.)

First, follow the directions here and grab an API key for Google Maps. This comes with a certain amount of free API calls per day (something like 2,500).

import googlemaps


gmaps = googlemaps.Client(key="your-key-here")

def geocode(place_name):
    geocode_result = gmaps.geocode(place_name)
    return geocode_result[0]['geometry']['location']

geocode("Casablanca, Morocco")
#  {u'lat': 33.5731104, u'lng': -7.589843399999999}

The whole gmaps.geocode response can actually be useful; it is a list of matches in descending order of closeness to what Google Maps thinks you were asking for, with each result in the following format:

{
  "geometry": {
    "location_type": "APPROXIMATE",
    "bounds": {
      "northeast": {
        "lat": 33.6486015,
        "lng": -7.4582757
      },
      "southwest": {
        "lat": 33.495279,
        "lng": -7.7165028
      }
    },
    "viewport": {
      "northeast": {
        "lat": 33.6486015,
        "lng": -7.4582757
      },
      "southwest": {
        "lat": 33.495279,
        "lng": -7.7165028
      }
    },
    "location": {
      "lat": 33.5731104,
      "lng": -7.589843399999999
    }
  },
  "address_components": [
    {
      "long_name": "Casablanca",
      "types": [
        "locality",
        "political"
      ],
      "short_name": "Casablanca"
    },
    {
      "long_name": "Grand Casablanca",
      "types": [
        "administrative_area_level_1",
        "political"
      ],
      "short_name": "Grand Casablanca"
    },
    {
      "long_name": "Morocco",
      "types": [
        "country",
        "political"
      ],
      "short_name": "MA"
    },
    {
      "long_name": "20000",
      "types": [
        "postal_code"
      ],
      "short_name": "20000"
    }
  ],
  "place_id": "ChIJOxGqeEfNpw0R0w8xT9jBBgs",
  "formatted_address": "Casablanca 20000, Morocco",
  "types": [
    "locality",
    "political"
  ]
}
1 Like

Locations for the villages are now available on the viz challenge page!

1 Like

Thanks so much for this data! I think it will be highly useful to visualize the consumption patterns and possibly even contrast them with the water generation patterns. For instance: Is there an uptick in water usage after heavy fog collection (suggesting that demand exceeds supply)?

Sidenote: thanks for the googlemaps in R info. Since we’re using Tableau for this competition, I actually haven’t done any viz work in R like I normally would.

Cheers!
Rudolph

Awesome! 2 villages are missing though - Agri Zekri and Medarssa Sidi Zekri. Did you get the others from Google Maps?

Maybe Bull can respond with the definitive coordinates but here was my approach:

  1. I omitted Medarssa Sidi Zekri because there was no water usage recorded.
  2. After a lot of Googling, I found coordinates for Agri Zekri (29.28747 -10.08099) on an online fundraising page. Now it could be wrong but it appears to be in the right area. As I said, hopefully Bull can clarify.

FYI. there are discrepancies between the spellings of two villages in the files - Agadir Id Lghachi and Id Achour

Hi @avsyap and @rudolph,

We’re still trying to track down exact coordinates for Mederassa Sidi Zekri and Agni Zekri, thanks for your patience. I’ll update you if we can get these two locations. If not, feel free to just pick a nearby location to use in your visualizations.

Also, all of the names are transliterated inconsistently, so there may be slight spelling differences.

Peter