A spatial data science project mapping primary crop recommendations across all Egyptian governorates using R, GADM shapefiles, and interactive visualization libraries.
# 🌾 Egypt Agricultural Suitability — Spatial Analysis in R
> A spatial data science project mapping primary crop recommendations across all Egyptian governorates using R, GADM shapefiles, and interactive visualization libraries.
**Student:** Osman Osama · Egyptian Chinese University (ECU)
**Course:** Spatial Statistics
**Data Sources:** CAPMAS Egypt / FAO Egypt / GADM
---
## 📸 Preview
### Static Choropleth Map
### Point Map (Governorate Centroids)
> 🖱️ An interactive HTML version is also generated — open `egypt_crops_map.html` or `egypt_meaningful_map.html` in any browser.
---
## 📁 Project Structure
```
egypt-agricultural-suitability/
│
├── egypt_crops_map_9.R # Main script: choropleth + interactive map + shapefile export
├── egypt_crops_point_map_final.R # Point map: leaflet-based interactive map by region
│
├── data/
│ ├── egypt_crops_data.csv # Agricultural suitability data (27 governorates)
│ ├── governorate_names.csv # Governorate names as exported from GADM shapefile
│ └── shapefile/
│ ├── egypt_crops.shp # Merged shapefile with crop & score attributes
│ ├── egypt_crops.dbf
│ ├── egypt_crops.prj
│ └── egypt_crops.shx
│
└── outputs/
├── egypt_crops_map.png # Static choropleth (primary crop per governorate)
├── egypt_crops_point_map.png # Static point map (size = score, color = crop)
├── egypt_crops_map.html # Interactive plotly choropleth
└── egypt_meaningful_map.html # Interactive leaflet point map (color by region)
```
---
## 🗺️ What the Project Does
### Script 1 — `egypt_crops_map_9.R`
- Downloads Egypt's administrative shapefile at governorate level using the **GADM** database (`geodata` package)
- Matches 27 governorates to a custom agricultural dataset (primary, secondary & tertiary crops + suitability score + key factor)
- Performs fuzzy string matching to handle Arabic transliteration differences
- Generates:
- **Static choropleth map** ( …