Home assignment 5

Home assignment 5

Last updated: 2022-06-22 18:56:15

Question 1

  • Import the following layers:

    • data/statisticalareas_demography2019.gdb—Statistical areas

    • output/sentinel2.tif—Sentinel-2 satellite image

  • Rescale 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 from output/sentinel2.tif.

/home/michael/.local/lib/python3.8/site-packages/geopandas/_compat.py:111: UserWarning: The Shapely GEOS version (3.8.0-CAPI-1.13.1 ) is incompatible with the GEOS version PyGEOS was compiled with (3.10.1-CAPI-1.16.0). Conversions between both will be slow.
  warnings.warn(
_images/home_assignment_5_6_1.png

Question 2

  • Import the following layers:

    • data/muni_il.shp—Israel towns

    • output/sentinel2.tif—Sentinel-2 satellite image

  • Aggregate 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 the sentinel2.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 from output/sentinel2.tif.

Muni_Heb geometry prop
20 תל שבע POLYGON ((189005.599 574096.060... 1.000000
10 לקיה POLYGON ((189348.301 580893.164... 1.000000
8 ללא שיפוט - אזור מזרחית לכפר תר... POLYGON ((175893.116 583724.715... 1.000000
3 באר שבע POLYGON ((181131.158 567199.093... 1.000000
0 אופקים POLYGON ((164545.816 581621.522... 1.000000
... ... ... ...
7 ללא שיפוט - אזור הסייג POLYGON ((182450.062 558067.875... 0.324498
16 רהט MULTIPOLYGON (((179268.044 5878... 0.321633
17 רמת נגב POLYGON ((166103.234 560823.188... 0.008725
2 אשכול POLYGON ((162069.094 562875.625... 0.004958
19 שדות נגב POLYGON ((163315.442 588025.764... 0.004126

21 rows × 3 columns