BaşlayınÜcretsiz Başlayın

Import and plot raster data

In this exercise, we are going to use a raster dataset of the vegetation types map (available from https://www.wri.org). The raster values take a set of discrete values indicating the type of vegetation. Let's start with reading the data and plotting it together with the mining site data.

The mining sites dataset (mining_sites) is already loaded, and GeoPandas and matplotlib are already imported.

Bu egzersiz

Working with Geospatial Data in Python

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Import the rasterio package.
  • Open the vegetation map geotiff file ("central_africa_vegetation_map_foraf.tif") and assign it to a variable src.
  • Plot the raster dataset using the rasterio.plot.show() function and add the mining site locations in red and marker size of 1.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Import the rasterio package
____

# Open the raster dataset
src = rasterio.____("central_africa_vegetation_map_foraf.tif")

# Import the plotting functionality of rasterio
import rasterio.plot

# Plot the raster layer with the mining sites
ax = rasterio.plot.show(____)
mining_sites.plot(____)
plt.show()
Kodu Düzenle ve Çalıştır