1
00:00:01,610 --> 00:00:07,770
Great, in the previous lecture I showed
you how a JSON file looks like and in

2
00:00:07,770 --> 00:00:13,500
this lecture I'll go ahead and add that
JSON fall to the code. Remember I

3
00:00:13,500 --> 00:00:17,699
provided you with the JSON file in the
previous lecture. You could download it

4
00:00:17,699 --> 00:00:25,740
from the lecture resources and so this
JSON method gets a data attribute which is

5
00:00:25,740 --> 00:00:35,010
equal to the file object of the JSON
data so basically you need to create a

6
00:00:35,010 --> 00:00:40,129
Python file object with which you can
create with open. Remember, open is a

7
00:00:40,129 --> 00:00:47,129
classic Python method for creating file
objects so there goes the path of the

8
00:00:47,129 --> 00:00:53,910
file. This happens to be in the same
directory with my map1.py script so I'm

9
00:00:53,910 --> 00:01:02,160
just passing world.json. Yeah, basically
you're opening it in read mode. And yeah,

10
00:01:02,160 --> 00:01:11,060
I'll leave it like that for now. Save,
execute. I think we'll get an error here.

11
00:01:13,460 --> 00:01:20,310
Yeah we need to add an encoding
parameter there as suggested by the

12
00:01:20,310 --> 00:01:35,090
error message. So that goes inside the
open method. Equals to utf-8-sig.

13
00:01:44,440 --> 00:01:50,500
Save again, go and execute.

14
00:01:53,440 --> 00:02:05,320
Reload, and yep we have the polygons displayed on
the map. So that was quite easy to do and

15
00:02:05,320 --> 00:02:11,560
something you should know is that you
can also add points through through

16
00:02:11,560 --> 00:02:16,840
GeoJSON so in this case we added
polygons, but that JSON file could also

17
00:02:16,840 --> 00:02:26,530
have lines or could also have points in
it's attributes. So you know this one we

18
00:02:26,530 --> 00:02:30,989
had an attribute that was stating these
are multi polygons, but this could be

19
00:02:30,989 --> 00:02:37,900
points or lines and in that case Folium
will display those features depending on

20
00:02:37,900 --> 00:02:44,220
this type attribute in here. Of course
you will you also have the coordinates

21
00:02:44,220 --> 00:02:49,269
attribute with the coordinates of the
line so the points where the line breaks

22
00:02:49,269 --> 00:02:55,720
and turn and in the case of points you
would have pairs of coordinates here.

23
00:02:55,720 --> 00:03:00,160
So I hope you get the idea. That was about
this lecture. In the next lecture I'll

24
00:03:00,160 --> 00:03:05,410
show you how to create a choropleth map
which is a map that uses coloring of

25
00:03:05,410 --> 00:03:11,049
areas to represent features. In this
particular case what we will do is we will

26
00:03:11,049 --> 00:03:15,280
have these polygons with different
colors to represent the population of

27
00:03:15,280 --> 00:03:20,000
the world for each country. We'll do that
in the next lecture. See you!

