Open arthurwilly opened 1 day ago
Thank you for pointing that out! Here’s my response:
I understand that you couldn’t run the code from the "Combining Separate Landcover Classes…" section onward. This happened because I generated the samples using map.user_rois
, which I noted in the notebook. For each class, I used the geemap Map
feature to draw regions on the map and then exported them as a FeatureCollection
using map.user_rois
.
For more details on this process, please refer to the cell titled "Combining Separate Landcover Classes into a Single Feature Collection." Additionally, I saved the sample collections to a GeoJSON file so that others can re-run the classification easily. Here’s the relevant code:
import geopandas as gpd
output_path = "landcover_data.geojson"
landcover_gdf.to_file(output_path, driver="GeoJSON")
print(f"GeoJSON file saved as {output_path}")
# Optionally, load the GeoJSON file back into a GeoDataFrame for verification
landcover_fc = gpd.read_file(output_path)
# Display the first few rows to verify the data
landcover_fc.head()
I’ll also add this GeoJSON file to the repository, so the code should now be runnable from this section onward. Please let me know if you have any further questions or if there’s anything else I can clarify!
Yes, I actually did compute the median in exactly that way. Here’s the code I used to reduce the image collection to its median and clip it to the region:
image = imageCollection.median()
image_roi = image.clip(boundingBox)
By using imageCollection.median()
, I’m reducing the entire collection to a single median image, then clipping it to the specified region (boundingBox
). Let me know if this clarifies things, or if you’d like any further details on this step!