Correction Lesson 5 Lab 1: Mapping Toronto Condo Boom Part2: Data Enrichment and Mapping

  • Calculate the time spent using the GREL: diff(cells['COMPLETED_DATE'].value, cells['ISSUE_DATE'].value, "weeks")

  • Join (cell.cross) based on the postal code using the result from the lab 4 using: cell.cross("postalcode","postalcode").cells["area"].value[0]

  • Query OpenStreetMap API: '[YOUR CONSUMER KEY]&callback=renderGeocode&location='+escape(value, 'url')

  • The new Mapquest results wrap the result into renderGeocode() . This extra wrap prevent OpenRefine to recongize the result as a JSON and so to use the parseJson() function. You need first to remove this element using either the replace() or split fuction:
    • value.replace('renderGeocode(','')
    • value.split('(')[1]
  • Parse the long: value.parseJson().results[0].locations[0].latLng.lng

  • Parse the lat: value.parseJson().results[0].locations[0]

  • Export in csv format

  • Load in mapbox to map the points.
Last modified: Saturday, 6 April 2019, 12:38 PM