geometry id population
149 POLYGON ((1990143 158 NaN
4848536, 2090…
Figure 3.14 shows the final result grid with the incongruently-joined population
attribute from nz.
base = grid.plot(
column='population',
edgecolor='black',
legend=True,
cmap='Reds'
);
nz.plot(ax=base, color='none', edgecolor='grey', legend=True);
, Figure 3.14: The nz layer and a regular grid of rectangles: final result
We can demonstrate that, expectedly, the summed population in nz and grid is
identical, even though the geometry is different (since we created grid to completely
cover nz), by comparing the .sum of the population attribute in both layers.
nz['Population'].sum()
np.float64(4787200.0)
grid['population'].sum()
np.float64(4787199.999999998)
The procedure in this section is known as an area-weighted interpolation of a
spatially extensive (e.g., population) variable. In extensive interpolation, we assume
that the variable of interest represents counts (such as, here, inhabitants) uniformly
distributed across space. In such case, each part of a given polygon captures the
respective proportion of counts (such as, half of a region with N inhabitants contains
N/2 inhabitants). Accordingly, summing the parts gives the total count of the total
area.
An area-weighted interpolation of a spatially intensive variable (e.g., population
density) is almost identical, except that we would have to calculate the weighted
.mean rather than .sum, to preserve the average rather than the sum. In intensive
interpolation, we assume that the variable of interest represents counts per unit area,
i.e., density. Since density is (assumed to be) uniform, any part of a given polygon
has exactly the same density as that of the whole polygon. Density values are
therefore computed as weighted averages, rather than sums, of the parts. Also, see the
‘Area-weighted interpolation’ section in Pebesma and Bivand (2023).
149 POLYGON ((1990143 158 NaN
4848536, 2090…
Figure 3.14 shows the final result grid with the incongruently-joined population
attribute from nz.
base = grid.plot(
column='population',
edgecolor='black',
legend=True,
cmap='Reds'
);
nz.plot(ax=base, color='none', edgecolor='grey', legend=True);
, Figure 3.14: The nz layer and a regular grid of rectangles: final result
We can demonstrate that, expectedly, the summed population in nz and grid is
identical, even though the geometry is different (since we created grid to completely
cover nz), by comparing the .sum of the population attribute in both layers.
nz['Population'].sum()
np.float64(4787200.0)
grid['population'].sum()
np.float64(4787199.999999998)
The procedure in this section is known as an area-weighted interpolation of a
spatially extensive (e.g., population) variable. In extensive interpolation, we assume
that the variable of interest represents counts (such as, here, inhabitants) uniformly
distributed across space. In such case, each part of a given polygon captures the
respective proportion of counts (such as, half of a region with N inhabitants contains
N/2 inhabitants). Accordingly, summing the parts gives the total count of the total
area.
An area-weighted interpolation of a spatially intensive variable (e.g., population
density) is almost identical, except that we would have to calculate the weighted
.mean rather than .sum, to preserve the average rather than the sum. In intensive
interpolation, we assume that the variable of interest represents counts per unit area,
i.e., density. Since density is (assumed to be) uniform, any part of a given polygon
has exactly the same density as that of the whole polygon. Density values are
therefore computed as weighted averages, rather than sums, of the parts. Also, see the
‘Area-weighted interpolation’ section in Pebesma and Bivand (2023).