An interactive web application to display the map of Iran’s provinces using ASP.NET Core and GeoJSON.
video link: https://youtu.be/koNlFu_4InE?si=Qds4lqRN6drlA_Pv
-
Interactive Map: Zoomable and pannable map of Iran’s provinces
-
Province Information: Display details of each province on click
-
Data Caching: Local caching of GeoJSON files for better performance
-
Database: Using Entity Framework Core and SQL Server
-
Beautiful UI: Modern and responsive design
-
Backend: ASP.NET Core 8.0
-
Frontend: HTML5, CSS3, JavaScript
-
Database: SQL Server with Entity Framework Core
-
Data Format: GeoJSON
-
UI Framework: Bootstrap
-
.NET 8.0 SDK
-
SQL Server (LocalDB or SQL Server Express)
-
Visual Studio 2022 or VS Code
git clone https://github.com/pouria-azad/IranMap.git
cd "map 3"There are two ways to create the database:
Run the SQLScript/file.sql file in SQL Server Management Studio or run via command line:
# Run SQL script using sqlcmd
sqlcmd -S . -i SQLScript/file.sql# Run migrations
dotnet ef database updateMake sure your database connection string is correct in appsettings.json:
{
"ConnectionStrings": {
"DefaultConnection": "Server=.;Database=IranMapDB;Trusted_Connection=True;MultipleActiveResultSets=true;Encrypt=True;TrustServerCertificate=True"
}
}dotnet runThe app will run at https://localhost:5001 or http://localhost:5000.
map 3/
├── Controllers/
│ └── IranMapController.cs # Main map controller
├── Data/
│ └── IranMapDbContext.cs # Database context
├── Models/
│ ├── MapSettings.cs # Map settings model
│ ├── ProvinceStats.cs # Province statistics model
│ └── ErrorViewModel.cs # Error model
├── Views/
│ ├── IranMap/
│ │ └── Index.cshtml # Main map page
│ └── Shared/IranMap/
│ └── Map/
│ ├── _InfoBox.cshtml # Info box partial view
│ └── _ProvinceInfoCard.cshtml # Province info card partial view
├── wwwroot/
│ ├── css/
│ │ └── map.css # Map styles
│ ├── js/
│ │ └── map.js # Map scripts
│ └── data/ # GeoJSON files
├── SQLScript/
│ └── file.sql # Database creation script
└── Migrations/ # EF migrations
GET /ProvinceMap/GetIranMap
Returns the GeoJSON file of the entire Iran map.
GET /ProvinceMap/GetProvinceData/{provinceCode}
Returns the GeoJSON data for the specified province code.
GET /GetProvincesList
Returns the list of all Iranian provinces.
Settings in appsettings.json:
-
LocalDataFolder: Folder for caching GeoJSON files locally -
IranGeoJsonUrl: URL for the full Iran GeoJSON file -
ProvinceGeoJsonUrlTemplate: Template URL for province GeoJSON files -
CacheDurationMinutes: Cache expiration time in minutes
-
Fork the repository
-
Create a new branch (
git checkout -b feature/amazing-feature) -
Commit your changes (
git commit -m 'Add amazing feature') -
Push to your branch (
git push origin feature/amazing-feature) -
Open a Pull Request
This project is licensed under the MIT License.
For questions or issues, please open an Issue.
Note: This project uses Iran GeoJSON data from the iran-geojson repository.