Skip to content

timtomch/cheesemap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cheesemap

This code maps artisanal cheeses extracted from the Canadian Cheese Directory open data. It was developed in collaboration with Sara Alain as a Hackfest project at the Code4Lib North meeting 2015.

The result is a geoJSON file with geolocated cheese specialities and dairy farms.

How does it work?

The CSV file downloaded from the Canadian Open Data portal is first filtered to only contain "artisanal" cheese specialities. It is then run through cheesemap.py, which uses the YellowPages Places API to try and find the address of each dairy farm. Only the name of the farm and the province code is available in the source file, so sadly only about 50% of entries can be thus mapped. The result is another CSV file that contains extra columns for latitude and longitude. Since the free API only allows 300 queries per day, the same CSV file can be re-run through the script. Only rows where the lat and lon pair is missing will then be queried. This allows the list to be gelolocated in batches.

  An earlier version of the script used the Google Places API instead, but this was found to be even less reliable.
  Note that an API key needs to be obtained from the YellowAPI service for the script to work.

The resulting CSV file is then run through csv2json.py to be turned into a geoJSON file, to be mapped by GitHub's built-in geoJSON engine.

Issues

  1. This is obviously just for fun and not very useful. The map does not display URLs, many producers fail to be mapped and are thus not displayed. Also, we still haven't tasted all the cheese!
  2. To check if the YellowPages API returned the right farm, a fuzzy text comparison (using fuzzywuzzy) is done between the name that was in the input data and the one returned by the API. This does not currently work very well, especially with French names. So more entries fail to be mapped because of this.
  3. I'm pretty sure at some point the latitude was substitued with the longitude and vice-versa. The result is fine, but don't trust the variable names.
  4. It would be nice not having to filter the input CSV file manually.
  5. It would also be nice to embed this map in an actual website and start playing around with leaflet.js so that it looks nicer.

Resources

About

hackfest project for code4lib north 2015

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages