Raster डेटा इम्पोर्ट करें और प्लॉट करें
इस अभ्यास में, हम vegetation types मैप के एक raster डेटासेट का उपयोग करेंगे (उपलब्ध: https://www.wri.org). Raster वैल्यूज़ विविक्त (discrete) मान लेती हैं जो वनस्पति के प्रकार दर्शाती हैं। आइए डेटा पढ़ने से शुरू करें और उसे mining site डेटा के साथ प्लॉट करें.
Mining sites का डेटासेट (mining_sites) पहले से लोड है, और GeoPandas तथा matplotlib पहले से इम्पोर्ट हैं.
यह अभ्यास पाठ्यक्रम का हिस्सा है
Python में Geospatial Data के साथ काम करना
अभ्यास निर्देश
rasterioपैकेज इम्पोर्ट करें.- vegetation मैप की geotiff फ़ाइल (
"central_africa_vegetation_map_foraf.tif") खोलें और उसे वैरिएबलsrcको असाइन करें. rasterio.plot.show()फंक्शन से raster डेटासेट प्लॉट करें, और mining site लोकेशन्स को लाल रंग में marker size 1 के साथ जोड़ें.
इंटरैक्टिव व्यावहारिक अभ्यास
इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।
# 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()