Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,000 --> 00:00:01,800
Often when you're working with tables,
2
00:00:01,800 --> 00:00:03,870
there's some operations you want to do like adding
3
00:00:03,870 --> 00:00:06,480
a column or doing some field calculations.
4
00:00:06,480 --> 00:00:09,630
So, I'm just going to walk through some of the basic ones that are more popular,
5
00:00:09,630 --> 00:00:11,430
that you probably want to use more often,
6
00:00:11,430 --> 00:00:13,510
and just show you how they work.
7
00:00:13,510 --> 00:00:20,080
Here I have a map of population values for provinces and territories in Canada.
8
00:00:20,260 --> 00:00:24,810
Mapping population counts for a Choropleth map is not really
9
00:00:24,810 --> 00:00:28,410
recommended because you end up with biases based on areas.
10
00:00:28,410 --> 00:00:32,280
So, we prefer to want to normalize that data or standardize it in
11
00:00:32,280 --> 00:00:36,680
some way by dividing by area in order to get a population density values.
12
00:00:36,680 --> 00:00:40,740
So, let's see how we could use a Field Calculations to help us do that.
13
00:00:40,740 --> 00:00:44,860
Here we have an attribute table for that data set.
14
00:00:44,860 --> 00:00:48,500
So, we have population values but we don't have anything about area or
15
00:00:48,500 --> 00:00:52,430
population density in order to be able to make a density Choropleth map.
16
00:00:52,430 --> 00:00:55,070
So, we can add a column for area and we
17
00:00:55,070 --> 00:00:58,810
can do calculations for density in order to fix that.
18
00:00:58,930 --> 00:01:01,165
It's easy to add a field,
19
00:01:01,165 --> 00:01:06,410
you can just do that by selecting up in this little dropdown here,
20
00:01:06,410 --> 00:01:11,060
you can select Add a Field and so here I've given it the name of Area,
21
00:01:11,060 --> 00:01:12,760
you can give it whatever name you want,
22
00:01:12,760 --> 00:01:15,040
it doesn't have to match what you're doing.
23
00:01:15,040 --> 00:01:21,005
Then, there'll be a dropdown here for the type of field that you want to add.
24
00:01:21,005 --> 00:01:23,460
These are the choices that are available to you.
25
00:01:23,460 --> 00:01:25,090
So, there's Short Integer, Long Integer,
26
00:01:25,090 --> 00:01:27,000
Float, Double, Text and so on.
27
00:01:27,000 --> 00:01:28,440
If you're not familiar with these,
28
00:01:28,440 --> 00:01:31,070
it's worth having some idea of
29
00:01:31,070 --> 00:01:34,950
what the definitions are for each of them so you know which of those to pick.
30
00:01:35,590 --> 00:01:39,160
So, here are the more common field data types.
31
00:01:39,160 --> 00:01:43,670
We have Short Integer and Long Integer which do not have decimal values,
32
00:01:43,670 --> 00:01:47,180
and then we have Float and Double which do have decimal values,
33
00:01:47,180 --> 00:01:52,235
and then we have Text that is for non-numerical values like characters,
34
00:01:52,235 --> 00:01:55,960
and then we have Date for literally dates.
35
00:01:55,960 --> 00:01:58,535
So, I don't know about you but I've never
36
00:01:58,535 --> 00:02:00,970
taken the time to memorize these particular numbers,
37
00:02:00,970 --> 00:02:02,775
I wouldn't expect you to do that either.
38
00:02:02,775 --> 00:02:05,360
But, I do think it's useful to kind of know so well
39
00:02:05,360 --> 00:02:08,140
why for example is there a Short Integer and a Long Integer.
40
00:02:08,140 --> 00:02:14,305
The idea is just that when we're creating a column in a database, when we add a field,
41
00:02:14,305 --> 00:02:16,655
we have to tell it how big that field should
42
00:02:16,655 --> 00:02:18,860
be because then the software is actually setting
43
00:02:18,860 --> 00:02:23,780
aside that storage space for that field whether we have numbers in it or not,
44
00:02:23,780 --> 00:02:26,360
and we always want to be as efficient as we can and
45
00:02:26,360 --> 00:02:29,260
only set aside as much space as we really need.
46
00:02:29,260 --> 00:02:32,000
So, why would we set aside a huge amount of space for
47
00:02:32,000 --> 00:02:35,995
really big numbers when all we plan on doing is storing small numbers?
48
00:02:35,995 --> 00:02:39,870
So, that's the thinking behind the idea of having a Short Integer.
49
00:02:39,870 --> 00:02:44,890
If you just have values between roughly negative 32,000 and positive 32,000,
50
00:02:44,890 --> 00:02:47,095
then you can just store them with short integers.
51
00:02:47,095 --> 00:02:50,260
But if you're going to store much larger numbers like this,
52
00:02:50,260 --> 00:02:52,950
then you would want to use the Long Integer.
53
00:02:52,950 --> 00:02:57,295
I won't go through all of these in a whole lot of detail but with Float and Double,
54
00:02:57,295 --> 00:02:59,630
essentially it's that you can now store
55
00:02:59,630 --> 00:03:02,395
decimal places as opposed to the Integer which you can't,
56
00:03:02,395 --> 00:03:06,510
and it's a matter of how many decimals or significant digits you can store.
57
00:03:06,510 --> 00:03:12,105
Text, the main thing I wanted to point out there is that it saves characters,
58
00:03:12,105 --> 00:03:15,590
but you can actually have numbers in a Text field.
59
00:03:15,590 --> 00:03:19,710
But the important thing here is that the software will not see them as numbers,
60
00:03:19,710 --> 00:03:22,840
it will just see them as characters. Why is that important?
61
00:03:22,840 --> 00:03:26,110
Well, for example, if you try to do a calculation on those,
62
00:03:26,110 --> 00:03:29,100
it would say well, I can't do a calculation on them because it's text,
63
00:03:29,100 --> 00:03:30,760
even if they are numbers.
64
00:03:30,760 --> 00:03:32,430
So, when will this come up?
65
00:03:32,430 --> 00:03:34,050
For example, if you have some kind of ID number,
66
00:03:34,050 --> 00:03:36,705
like a student number, or social insurance number for somebody.
67
00:03:36,705 --> 00:03:39,950
Really, that's not something that you plan on doing calculations on,
68
00:03:39,950 --> 00:03:42,230
so it may end up being stored in a Text field.
69
00:03:42,230 --> 00:03:43,730
That's one example.
70
00:03:43,730 --> 00:03:45,410
But sometimes inadvertently,
71
00:03:45,410 --> 00:03:49,350
you have values that you do want to do a calculation on that are stored in a Text field.
72
00:03:49,350 --> 00:03:51,230
So, you can't do that if it's in
73
00:03:51,230 --> 00:03:54,460
a Text column instead of in an Integer column or something like that.
74
00:03:54,460 --> 00:03:58,340
Just while I'm thinking of it, another situation where this is relevant is
75
00:03:58,340 --> 00:04:02,230
if you're trying to join two tables together based on numbers.
76
00:04:02,230 --> 00:04:06,410
If in one table they're stored as numbers and the others they are stored as text,
77
00:04:06,410 --> 00:04:07,955
you won't be able to join those together
78
00:04:07,955 --> 00:04:10,090
even if they actually look like the same numbers.
79
00:04:10,090 --> 00:04:11,950
Because as far as the software is concerned,
80
00:04:11,950 --> 00:04:13,670
they are different things, they are not the same field.
81
00:04:13,670 --> 00:04:18,260
You have to have the same field type in order to be able to join them together.
82
00:04:18,260 --> 00:04:22,320
So, it's just important that you understand what these things are,
83
00:04:22,320 --> 00:04:23,390
I think it's always important.
84
00:04:23,390 --> 00:04:28,125
I always encourage people when there are faced with a decision like this,
85
00:04:28,125 --> 00:04:31,670
is to make a conscious educated informed decision
86
00:04:31,670 --> 00:04:33,620
instead of just kind of crossing your fingers going,
87
00:04:33,620 --> 00:04:35,160
"Well, this one kind of looks right."
88
00:04:35,160 --> 00:04:37,180
So, that's all I wanted to say there is,
89
00:04:37,180 --> 00:04:38,310
just be familiar with them.
90
00:04:38,310 --> 00:04:41,305
Know which one to choose and why, and let's move on.
91
00:04:41,305 --> 00:04:44,975
So now, I've got my Area column or Field that's been added,
92
00:04:44,975 --> 00:04:46,950
but you'll notice that it's filled with zeros.
93
00:04:46,950 --> 00:04:49,585
Is that the software is not smart enough to know that,
94
00:04:49,585 --> 00:04:50,750
"Oh, he called it area.
95
00:04:50,750 --> 00:04:53,760
So maybe, I should calculate the areas for all of the polygons that he has."
96
00:04:53,760 --> 00:04:55,365
No, it doesn't work that way.
97
00:04:55,365 --> 00:04:58,100
So, all I've done now is I've created the field,
98
00:04:58,100 --> 00:05:00,620
I've set aside the storage space, if you want,
99
00:05:00,620 --> 00:05:04,360
for the areas that I'm going to then calculate.
100
00:05:04,700 --> 00:05:10,190
All I have to do is right-click on that field and select Calculate Geometry.
101
00:05:10,190 --> 00:05:13,010
As it says here, I'm not going to read this exactly,
102
00:05:13,010 --> 00:05:17,165
but this will give you options for calculating things like areas and perimeters.
103
00:05:17,165 --> 00:05:20,695
So, when you get to the dialog box you can say,
104
00:05:20,695 --> 00:05:22,200
"Okay, what do I want to calculate?"
105
00:05:22,200 --> 00:05:23,900
In this case, it's going to be area.
106
00:05:23,900 --> 00:05:28,430
You have to tell it what's the coordinate system that you're going to use for that.
107
00:05:28,430 --> 00:05:32,460
It's important that it be a coordinate system where areas are maintained.
108
00:05:32,460 --> 00:05:36,065
So, in this case, it's an Equal Area Conic projection.
109
00:05:36,065 --> 00:05:38,660
Therefore, the areas that I'm going to
110
00:05:38,660 --> 00:05:41,890
calculate are going to be correct as opposed to if I'd say,
111
00:05:41,890 --> 00:05:43,840
for example, used the conformal projection,
112
00:05:43,840 --> 00:05:45,165
then they would not be correct.
113
00:05:45,165 --> 00:05:49,220
So, it's important that you know what the coordinate system is that you're using in
114
00:05:49,220 --> 00:05:53,720
the projection related to that and that the calculations are being done correctly.
115
00:05:53,720 --> 00:05:54,990
So, I know that these are equal area,
116
00:05:54,990 --> 00:05:57,290
so that's going to work.
117
00:05:57,290 --> 00:05:59,550
I've chosen the units to be square kilometers,
118
00:05:59,550 --> 00:06:00,700
I think that makes the most sense.
119
00:06:00,700 --> 00:06:04,475
For Areas the size we're talking about things that are provinces and territories.
120
00:06:04,475 --> 00:06:06,070
Depending on the areas that you're working with,
121
00:06:06,070 --> 00:06:09,115
you might want to use something else like square miles or square meters,
122
00:06:09,115 --> 00:06:11,925
but here square kilometers makes the most sense.
123
00:06:11,925 --> 00:06:16,440
So, now you'll see that once I've closed that dialog box,
124
00:06:16,440 --> 00:06:21,520
it does the area calculations and populates that field with areas in square kilometers.
125
00:06:21,520 --> 00:06:23,840
So, I now have areas available for me
126
00:06:23,840 --> 00:06:26,695
to be able to use for my population density mapping.
127
00:06:26,695 --> 00:06:29,390
There's two ways that I can then create
128
00:06:29,390 --> 00:06:32,560
a Choropleth map of population density and I'll show you both of them.
129
00:06:32,560 --> 00:06:35,320
One is to do normalization in the symbology.
130
00:06:35,320 --> 00:06:36,680
What do I mean by that?
131
00:06:36,680 --> 00:06:38,630
Well, remember, all the normalization is,
132
00:06:38,630 --> 00:06:43,250
is that we're going to remove the bias in our values
133
00:06:43,250 --> 00:06:48,530
to make our Choropleth map more true to what it is that we're trying to interpret.
134
00:06:48,530 --> 00:06:50,960
In other words, here we want to divide
135
00:06:50,960 --> 00:06:53,965
the population by the area in order to calculate density.
136
00:06:53,965 --> 00:06:55,570
That's known as normalization.
137
00:06:55,570 --> 00:06:58,700
So, here I've selected the value to be
138
00:06:58,700 --> 00:07:02,480
population and the normalization to be the area, and when I do that,
139
00:07:02,480 --> 00:07:05,530
I can then choose whatever classification method I want,
140
00:07:05,530 --> 00:07:06,739
the number of classes,
141
00:07:06,739 --> 00:07:09,760
and we'll end up with our classification scheme down here and so on.
142
00:07:09,760 --> 00:07:13,950
But the important thing is that this is being done on the fly so to speak.
143
00:07:13,950 --> 00:07:17,630
That's like nerd language for saying that there's nothing about
144
00:07:17,630 --> 00:07:21,780
the actual density values that are calculated that's going to be stored in the dataset.
145
00:07:21,780 --> 00:07:25,020
You won't see density values in our table anywhere.
146
00:07:25,020 --> 00:07:26,360
It's just going through that.
147
00:07:26,360 --> 00:07:28,700
As soon as I click this dialog box, it'll say,
148
00:07:28,700 --> 00:07:31,195
"Okay, population value, area,
149
00:07:31,195 --> 00:07:32,530
divide the two get the density.
150
00:07:32,530 --> 00:07:34,815
How would that look on the map? Let's show it on the map."
151
00:07:34,815 --> 00:07:37,070
So, that's literally doing it on the fly.
152
00:07:37,070 --> 00:07:43,030
So, let's see what happens. So, here's our population density map for Canada,
153
00:07:43,030 --> 00:07:44,645
for provinces and territories.
154
00:07:44,645 --> 00:07:48,790
As you might imagine, the territories are fairly low in population density.
155
00:07:48,790 --> 00:07:52,080
Ontario is the highest and then we have some that are in between.
156
00:07:52,080 --> 00:07:54,860
So, this has accomplished the task that I was trying to do,
157
00:07:54,860 --> 00:07:57,695
which is make a Choropleth map of population density.
158
00:07:57,695 --> 00:07:59,630
The only thing here is that there's nothing in
159
00:07:59,630 --> 00:08:01,960
my dataset that's storing those density values.
160
00:08:01,960 --> 00:08:05,250
So, if I want to do that then I have to go and calculate those density values.
161
00:08:05,250 --> 00:08:06,825
So, let's see how that works.
162
00:08:06,825 --> 00:08:10,650
So, I went ahead and added a field for Density
163
00:08:10,650 --> 00:08:15,760
and I'm now going to use the Field Calculator.
164
00:08:15,760 --> 00:08:17,660
So, if I right-click on that field,
165
00:08:17,660 --> 00:08:19,250
I just select Field Calculator,
166
00:08:19,250 --> 00:08:21,650
and then you get this dialog box here where
167
00:08:21,650 --> 00:08:23,850
you can select the field that you want to use.
168
00:08:23,850 --> 00:08:28,260
So, in this case, I have Area and Population,
169
00:08:28,260 --> 00:08:29,980
and you'll notice that these are,
170
00:08:29,980 --> 00:08:32,630
I might as well mention this now is that you will see that some of them say
171
00:08:32,630 --> 00:08:37,750
Provinces.Something and some of them say Prov_pop.Something.
172
00:08:37,990 --> 00:08:41,050
What I did here is I have joined these tables together.
173
00:08:41,050 --> 00:08:44,210
I actually have two different tables that I'm using at the same time,
174
00:08:44,210 --> 00:08:46,160
but it's treating them all as though all
175
00:08:46,160 --> 00:08:48,400
of these fields is other part of the same big table.
176
00:08:48,400 --> 00:08:52,770
So, now I can divide Population by Area.
177
00:08:52,770 --> 00:08:55,280
Just so happens that the population is coming from
178
00:08:55,280 --> 00:08:59,930
the Prov_pop table and the Area data is coming from the Provinces' table.
179
00:08:59,930 --> 00:09:01,520
Just so that's clear,
180
00:09:01,520 --> 00:09:03,890
because whenever you see stuff like that, I want you to,
181
00:09:03,890 --> 00:09:06,420
instead of just glossing over your eyes,
182
00:09:06,420 --> 00:09:08,855
guys glazing over and going, "I don't what I'm looking out there."
183
00:09:08,855 --> 00:09:10,465
It's really not that complicated,
184
00:09:10,465 --> 00:09:12,770
it's just these are in square brackets,
185
00:09:12,770 --> 00:09:14,875
so that this is sort of one package,
186
00:09:14,875 --> 00:09:16,685
this is another little package.
187
00:09:16,685 --> 00:09:18,945
We're dividing one by the other,
188
00:09:18,945 --> 00:09:20,725
that's what the dividing symbol is.
189
00:09:20,725 --> 00:09:23,580
So, I'm dividing population by area,
190
00:09:23,580 --> 00:09:27,195
it's just telling me the dots in one table and that's in another.
191
00:09:27,195 --> 00:09:30,490
So, that's all there is to it. Population divided by Area.
192
00:09:30,980 --> 00:09:34,355
So, then when I close that dialog box,
193
00:09:34,355 --> 00:09:38,620
now I have Density values in my table.
194
00:09:38,620 --> 00:09:42,290
So, I can then use those to create my Choropleth map if I want.
195
00:09:42,290 --> 00:09:44,060
So, I have my area data,
196
00:09:44,060 --> 00:09:45,535
I've got my population data,
197
00:09:45,535 --> 00:09:49,290
and both of those were used together to make my density data.
198
00:09:49,290 --> 00:09:52,625
So, now if I go into the symbology,
199
00:09:52,625 --> 00:09:55,895
I can use density as my value.
200
00:09:55,895 --> 00:09:58,570
Again, this is something I find some people get confused by.
201
00:09:58,570 --> 00:10:01,365
If the density value is already been calculated,
202
00:10:01,365 --> 00:10:04,040
then you do not need to normalize it in
203
00:10:04,040 --> 00:10:07,800
the symbology dialog box because you've already done that normalization,
204
00:10:07,800 --> 00:10:10,100
because the density value has already been calculated.
205
00:10:10,100 --> 00:10:13,580
That's what that means. Otherwise, you basically go through
206
00:10:13,580 --> 00:10:19,225
the same classification method and classes that you would with anything else,
207
00:10:19,225 --> 00:10:22,100
and this gives you your color scheme just like you would with anything.
208
00:10:22,100 --> 00:10:25,930
So, now, you end up with a choropleth map of population density.
209
00:10:25,930 --> 00:10:30,350
So, visually, this looks exactly the same as if I had done it with symbology alone,
210
00:10:30,350 --> 00:10:32,090
and done the normalization there,
211
00:10:32,090 --> 00:10:34,605
and done the calculation for density on the fly.
212
00:10:34,605 --> 00:10:38,170
But now, if it's important to me or if I need to do that,
213
00:10:38,170 --> 00:10:41,270
I can use the Field Calculator to
214
00:10:41,270 --> 00:10:45,310
calculate the density values to keep those in my attribute dataset.
215
00:10:45,310 --> 00:10:47,290
So, you can use either method.
216
00:10:47,290 --> 00:10:49,430
It completely depends on what you're using it for,
217
00:10:49,430 --> 00:10:51,170
whether it's important to you to have those in there.
218
00:10:51,170 --> 00:10:53,990
But I thought it'd be useful to show you how to do those calculations,
219
00:10:53,990 --> 00:10:55,885
how to add a field,
220
00:10:55,885 --> 00:10:57,180
do a field calculation,
221
00:10:57,180 --> 00:11:00,860
do a calculate geometry if you want to measure things like areas or perimeters,
222
00:11:00,860 --> 00:11:04,350
and then show you a typical example of one that will be useful.19490
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.