Afrikaans
Akan
Albanian
Amharic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Hungarian
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranรฎ)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
1
Hi, welcome again and in this lecture I'll
show you how to add another layer to
3
this map. Currently we have two layers we
have the base map which are map tiles by
5
map box you can see here and the data
are served by Open Street Map and you
7
also have your custom layer as well
which is a layer containing circle
9
markers. So in GIS, geographic information
systems these are referred to as layers.
11
Now I'd like to add a third layer to my
map and that will be a polygon layer.
13
So this current layer with markers, this
can be referred to as a point layer.
15
You also have line layers and polygon
layers so with points, points are better
17
to represent locations and you have
lines, lines are best for representing
19
geographical features which resembles
lines such as roads and rivers and then
21
we have polygons. Polygons are best to
represent areas so for instance in this
23
lecture what I'll show you is how to add
a layer, a polygon layer that represents
25
world population by country, so countries
are represented as areas and what we're
27
going to do is each of the countries
will have a specific color which will
29
indicate the population of that country
so points for locations lines, for lines,
31
and polygons for areas. Now of course you
need to have some data to create
33
a polygon layer. You know just like as we
did with markers we had some data in CSV
35
in text format and then we used those
data, we opened them with Pandas and then
37
we iterated through those lines of
data and we added the markers to the map.
39
Now for polygons the way to add
polygons via Folium is by
41
using the folium.GeoJson method,
so basically let me make some space here
43
the way this would work is you want to
add to feature group the variable here.
45
You want to add a child which will be a
folium.GeoJson object. So this is the
47
method with brackets here that creates
a GeoJSON object and for GeoJSON data we
49
will use this world.JSON file. You
can find this attached in this lecture
51
and let me explain what this is, but
careful, don't open it on Atom
53
because if your computer is a bit slow
your atom may crash, so try to open
55
it with a lighter editor such as notepad
for instance, or cat on a Linux terminal
57
or Mac. Anyway this is the JSON file you
can refer to it as JSON or GeoJson.
59
Actually GeoJSON is a special case of
JSON. Basically the format is always the
61
same, it starts with curly brackets and
basically it contains a string which is
63
like a Python dictionary with keys and
values. Keys, key and value where this
65
curly bracket ends somewhere here I
believe. If I'm not wrong. This one ends
67
in here, yeah. Then you have the other key,
geometry. So what is geometry? When the
69
type of geometry is multi polygon so
basically you have this kind of
71
attributes that describe the data.
Type multi polygon or coordinates.
73
So this is now starting to describe the features,
the polygons so these are the
75
coordinates over the first polygon that
will be displayed on the map. Let's say
77
this is one specific country and that's
that's, that's Antigua and Barbuda, yeah.
79
A small country but anyway and these are
the coordinates that will determine the
81
location of the polygon in your map so
basically Folium will read all this
83
information and it will decide where to put
the polygons and then you can also use
85
other attributes of this such as
population which is here, yeah. You will use
87
this population value to put a color for
that population and so on and so forth.
89
You have all countries of the world in
this JSON file, so spend a few minutes
91
looking at this file to understand its
structure and in the next lecture I'll
93
go ahead and load the JSON file into
Python and display the polygon layer.
95
See you there!
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.