Folium not recognizing JSON from TravelTime

130 Views Asked by At

I'm attempting to create a isochrone map in Jupyter Notebook/Folium, showing how far from downtown Chicago you could get in 45 minutes by car. TravelTime (TravelTime.com) has a ton of excellent APIs to do this, but I'm unable to plot them into Folium/Jupyter Notebook.

Here's a link to the JSON produced by TravelTime.

Here's what I've tried codewise:

import folium
import json
m = folium.Map([41.87899134154521, -87.63554279241286], zoom_start=6.5)
with open('chicago.json', 'r') as openfile:
     json_object = json.load(openfile)
folium.GeoJson(json_object).add_to(m)
m

It produces a blank Folium map. No polygon showing the drivetime json. Console has an error message:

"Uncaught Error: Invalid GeoJSON object."

The output produced by TravelTime does seem much different than other GeoJSONs I've seen on Stackoverflow and elsewhere.

I tried converting the JSON to a dict, but that didn't work.

1

There are 1 best solutions below

1
Krbin On

Anybody having the same problem as me, see this post by a Travel Time dev to get Travel Time to directly generate a GeoJson for you.