Home assignment 5#
Last updated: 2023-05-27 16:41:27
Question 1#
Import the following layers:
data/statisticalareas_demography2019.gdb
—Statistical areas
output/sentinel2.tif
—Sentinel-2 satellite imageRescale the raster values to the 0-1 range (see Rescaling) and calculate NDVI (see Calculating indices)
Calculate the average NDVI per statistical area in Beer-Sheva (
'SHEM_YISHUV'
column =='באר שבע'
), using zonal statistics (see Zonal statistics).Plot the layer of average NDVI in statistical areas of Beer-Sheva. Use the
"Greens"
color map.Note: Do not re-create
sentinel2.tif
in your code. Instead, import it fromoutput/sentinel2.tif
.

Question 2#
Import the following layers:
data/muni_il.shp
—Israel towns
output/sentinel2.tif
—Sentinel-2 satellite imageAggregate the towns layer according to the
'Muni_Heb'
column to dissolve the separate polygons per town (see Aggregation (.dissolve)).Calculate an attribute named
prop
with the proportion of each towns’ polygon area that is within the extent of thesentinel2.tif
image (Stacking raster bands). For example, Beer-Sheva is 100% within the image (prop=1.0
), Meitar is ~60% within the image (prop=0.6
), etc. Hint: calculate the area of the original polygons, then calculate the area of the intersections (see Set-operations (.overlay)) with image extent polygon (see Raster extent), and finally divide the intersection area by the total area.Print the subset of towns layer where the proportion intersecting with the image extent is above
0
, sorted by the proportion.Note: Do not re-create
sentinel2.tif
in your code. Instead, import it fromoutput/sentinel2.tif
.
Muni_Heb | geometry | prop | |
---|---|---|---|
0 | ××פק×× | POLYGON Z ((164539.498 577897.3... | 1.000000 |
19 | ×ª× ×©××¢ | POLYGON Z ((186092.170 571779.8... | 1.000000 |
9 | ××§×× | POLYGON Z ((189351.635 580896.1... | 1.000000 |
17 | ש×× ×©××× | POLYGON Z ((185362.919 569993.6... | 1.000000 |
5 | ×××¨× | POLYGON Z ((196441.958 579178.0... | 1.000000 |
... | ... | ... | ... |
7 | ××× ×©×פ×× - ×××ר ×... | POLYGON Z ((194986.638 558104.9... | 0.306161 |
16 | ר×ת × ×× | POLYGON Z ((161943.641 560017.1... | 0.008787 |
18 | ש××ת × ×× | POLYGON Z ((163386.026 588037.3... | 0.005279 |
20 | ת×ר | POLYGON Z ((197850.673 579873.8... | 0.004636 |
2 | ×ש××× | POLYGON Z ((162103.190 562458.3... | 0.003453 |
21 rows × 3 columns