Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,030 --> 00:00:06,660
Hi, welcome again and in this lecture I'll
show you how to add another layer to
3
00:00:06,660 --> 00:00:12,929
this map. Currently we have two layers we
have the base map which are map tiles by
5
00:00:12,929 --> 00:00:19,740
map box you can see here and the data
are served by Open Street Map and you
7
00:00:19,740 --> 00:00:24,660
also have your custom layer as well
which is a layer containing circle
9
00:00:24,660 --> 00:00:31,969
markers. So in GIS, geographic information
systems these are referred to as layers.
11
00:00:31,969 --> 00:00:38,809
Now I'd like to add a third layer to my
map and that will be a polygon layer.
13
00:00:38,809 --> 00:00:45,260
So this current layer with markers, this
can be referred to as a point layer.
15
00:00:45,260 --> 00:00:51,690
You also have line layers and polygon
layers so with points, points are better
17
00:00:51,690 --> 00:00:57,739
to represent locations and you have
lines, lines are best for representing
19
00:00:57,739 --> 00:01:04,920
geographical features which resembles
lines such as roads and rivers and then
21
00:01:04,920 --> 00:01:11,659
we have polygons. Polygons are best to
represent areas so for instance in this
23
00:01:11,659 --> 00:01:17,210
lecture what I'll show you is how to add
a layer, a polygon layer that represents
25
00:01:17,210 --> 00:01:25,920
world population by country, so countries
are represented as areas and what we're
27
00:01:25,920 --> 00:01:31,799
going to do is each of the countries
will have a specific color which will
29
00:01:31,799 --> 00:01:37,320
indicate the population of that country
so points for locations lines, for lines,
31
00:01:37,320 --> 00:01:44,720
and polygons for areas. Now of course you
need to have some data to create
33
00:01:44,720 --> 00:01:51,750
a polygon layer. You know just like as we
did with markers we had some data in CSV
35
00:01:51,750 --> 00:01:58,950
in text format and then we used those
data, we opened them with Pandas and then
37
00:01:58,950 --> 00:02:05,189
we iterated through those lines of
data and we added the markers to the map.
39
00:02:05,189 --> 00:02:13,450
Now for polygons the way to add
polygons via Folium is by
41
00:02:13,450 --> 00:02:21,010
using the folium.GeoJson method,
so basically let me make some space here
43
00:02:21,010 --> 00:02:27,780
the way this would work is you want to
add to feature group the variable here.
45
00:02:27,780 --> 00:02:37,360
You want to add a child which will be a
folium.GeoJson object. So this is the
47
00:02:37,360 --> 00:02:46,030
method with brackets here that creates
a GeoJSON object and for GeoJSON data we
49
00:02:46,030 --> 00:02:52,630
will use this world.JSON file. You
can find this attached in this lecture
51
00:02:52,630 --> 00:02:57,340
and let me explain what this is, but
careful, don't open it on Atom
53
00:02:57,340 --> 00:03:05,200
because if your computer is a bit slow
your atom may crash, so try to open
55
00:03:05,200 --> 00:03:12,250
it with a lighter editor such as notepad
for instance, or cat on a Linux terminal
57
00:03:12,250 --> 00:03:20,290
or Mac. Anyway this is the JSON file you
can refer to it as JSON or GeoJson.
59
00:03:20,290 --> 00:03:27,370
Actually GeoJSON is a special case of
JSON. Basically the format is always the
61
00:03:27,370 --> 00:03:34,090
same, it starts with curly brackets and
basically it contains a string which is
63
00:03:34,090 --> 00:03:45,880
like a Python dictionary with keys and
values. Keys, key and value where this
65
00:03:45,880 --> 00:03:52,299
curly bracket ends somewhere here I
believe. If I'm not wrong. This one ends
67
00:03:52,299 --> 00:04:00,130
in here, yeah. Then you have the other key,
geometry. So what is geometry? When the
69
00:04:00,130 --> 00:04:06,250
type of geometry is multi polygon so
basically you have this kind of
71
00:04:06,250 --> 00:04:15,030
attributes that describe the data.
Type multi polygon or coordinates.
73
00:04:18,480 --> 00:04:23,520
So this is now starting to describe the features,
the polygons so these are the
75
00:04:23,520 --> 00:04:27,750
coordinates over the first polygon that
will be displayed on the map. Let's say
77
00:04:27,750 --> 00:04:36,560
this is one specific country and that's
that's, that's Antigua and Barbuda, yeah.
79
00:04:36,560 --> 00:04:43,770
A small country but anyway and these are
the coordinates that will determine the
81
00:04:43,770 --> 00:04:50,010
location of the polygon in your map so
basically Folium will read all this
83
00:04:50,010 --> 00:04:57,720
information and it will decide where to put
the polygons and then you can also use
85
00:04:57,720 --> 00:05:04,920
other attributes of this such as
population which is here, yeah. You will use
87
00:05:04,920 --> 00:05:13,050
this population value to put a color for
that population and so on and so forth.
89
00:05:13,050 --> 00:05:20,280
You have all countries of the world in
this JSON file, so spend a few minutes
91
00:05:20,280 --> 00:05:26,070
looking at this file to understand its
structure and in the next lecture I'll
93
00:05:26,070 --> 00:05:32,570
go ahead and load the JSON file into
Python and display the polygon layer.
95
00:05:32,570 --> 00:05:34,000
See you there!
5767
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.