Skip to content
Advertisement

Problem with loading a json file for geo_data in python

I am currently trying to use folium library in python to create webmaps. I have a file world.json which contains geo_data. I have provided a link to the file at the end of this post. I tried the following code:

JavaScript

and received the following error:

JavaScript

How can I load this file?

What I want to achieve is essentially obtain the population data and create a Choropleth and overlay it on my webmap.

Edit: Forgot the link:

https://1drv.ms/u/s!Army95vqcKXpaooVAZU_g-VCAVw?e=vwTknq

Edit: Previous link to skydrive stopped working due to “high traffic”. Below is link to dropbox, hopefully this works:

https://www.dropbox.com/s/gmm8db0g03rc7cv/world.json?dl=0

Advertisement

Answer

Good news/bad news: It turns out that this file was encoded in a locale that we are not accustomed to, and json/ascii cannot make sense of some of the character encoding. I tried this, and it seems to be working for me — with a major caveat:

JavaScript

The major caveat is that only 3 countries come through with no encoding errors:

JavaScript

Maybe there another source for this data that is closer to a native english locale, or maybe someone else can provide wisdom in encoding foreign data in a more friendly way…

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement