An open API service indexing awesome lists of open source software.

https://github.com/hosseinnarimanirad/maptor

Maptor (MakanNegar): Open-source .NET GIS library for spatial data processing, analysis, and visualization
https://github.com/hosseinnarimanirad/maptor

cartography geodesy geographic-information-systems geography geomatics geometry geospatial gis map spatial spatial-analysis spatial-data surveying

Last synced: about 2 months ago
JSON representation

Maptor (MakanNegar): Open-source .NET GIS library for spatial data processing, analysis, and visualization

Awesome Lists containing this project

README

          

# ๐ŸŒ Maptor Spatial Library

[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/hosseinnarimanirad/Maptor/blob/master/LICENSE)
[![Build](https://img.shields.io/github/actions/workflow/status/hosseinnarimanirad/Maptor/master-release.yml)](https://github.com/hosseinnarimanirad/Maptor/actions)
[![Contributions Welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg)](CONTRIBUTING.md)
[![.NET](https://img.shields.io/badge/.NET-8.0-blue.svg)](https://dotnet.microsoft.com/download/dotnet/8.0)
[![NuGet](https://img.shields.io/nuget/v/IRI.Maptor.Sta.Spatial.svg?style=flat-square)](https://www.nuget.org/packages/IRI.Maptor.Sta.Spatial)
![GitHub last commit](https://img.shields.io/github/last-commit/hosseinnarimanirad/Maptor)

**A comprehensive .NET GIS library for spatial data modeling, processing, and visualization**

Maptor is a powerful, open-source .NET library designed to make spatial operations, geospatial data processing, and map visualization accessible and efficient. Built for **.NET 8+**, it provides a complete toolkit for geometry operations, coordinate transformations, data I/O, and advanced spatial algorithms.

---

## ๐Ÿš€ Quick Start

### Add a Console Project
Add a new C# console project

### Installation
```bash
# Core spatial functionality
dotnet add package IRI.Maptor.Sta.Spatial
```

### Basic Usage
```csharp
using IRI.Maptor.Extensions;
using IRI.Maptor.Sta.Common.Primitives;
using IRI.Maptor.Sta.Spatial.Primitives;
using IRI.Maptor.Sta.SpatialReferenceSystem;

// Create and work with points
var point1 = new Point(51.5074, -0.1278); // London
var point2 = new Point(40.7128, -74.0060); // New York

// Create geometries
var line = Geometry.CreatePointOrLineString(SridHelper.GeodeticWGS84, point1, point2);

var ellipsoidal_length = line.GetEllipsoidalLength();
var spherical_length = line.GetSphericalLength();

// Calculate length
Console.WriteLine($"ellipsoidal distance: {ellipsoidal_length:N1} km");
Console.WriteLine($" spherical distance: {spherical_length:N1} km");

// Convert to GeoJSON
var geoJsonLine = line.AsGeoJson().Serialize(indented: true);
Console.WriteLine($"line: {geoJsonLine}");

Console.Read();
```

---

## โœจ Key Features

### ๐Ÿ—บ๏ธ **Spatial Reference Systems**
- **15+ predefined ellipsoids** (WGS84, GRS80, Clarke 1866, etc.)
- **Coordinate transformations** (UTM, Mercator, WebMercator, Lambert, etc.)
- **Custom SRID support** for specialized projections
- **Geodetic calculations** with high precision

### ๐Ÿ”ง **Geometry Operations**
- **Complete geometry types**: Points, Lines, Polygons, MultiPoints, MultiLines, MultiPolygons
- **Advanced algorithms**: Delaunay triangulation, Voronoi diagrams, convex hulls
- **Spatial indexing**: KdTree, RTree for efficient spatial queries

### ๐Ÿ“Š **Data I/O & Formats**
- **Vector formats**:
- **Standard formats**: Shapefile, GeoJSON, KML, KMZ, GPX, WKB, WKT
- **Topology formats**: TopoJSON (with topology encoding and quantization support)
- **CAD/Graphics formats**: DXF, SVG, EPS (with styling support and round-trip coordinate preservation)
- **Document formats**: PDF (vector graphics export)
- **Columnar formats**: GeoParquet (efficient columnar geospatial data storage)
- **SQL Server Native Binary**: Native spatial data format
- **Raster support**: GeoTIFF (Worldfile), GRD file, custom raster formats
- **Terrain formats**:
- **Cesium Terrain**: quantized-mesh-1.0 (adaptive triangle meshes) and heightmap-1.0 (regular grids) for 3D terrain visualization
- **Tile formats**:
- **PMTiles**: Serverless tile archive format (vector and raster tiles)
- **MBTiles**: SQLite-based tile storage for offline mapping
- **GeoPackage tiles**: OGC standard tile storage
- **Database integration**: SQL Server Spatial, PostGIS, Personal GDB, SQLite/GeoPackage, MBTiles
- **OGC standards**: WFS, WMS, GML 2/3, SFA, SLD styling
- **Format features**:
- Round-trip conversion with exact coordinate preservation (SVG, EPS, DXF)
- Styling support (colors, stroke width, opacity) for CAD/graphics formats
- Topology preservation in TopoJSON
- Efficient compression and quantization options

### ๐Ÿงฎ **Advanced Algorithms**
- **Graph algorithms**: BFS, DFS, Dijkstra, Minimum Spanning Tree, MinCut
- **Machine learning**: Clustering, Apriori, Logistic Regression
- **Computational geometry**: Triangulation, simplification, generalization
- **Spatial analysis**: Interpolation, statistics, terrain modeling

### ๐Ÿ–ฅ๏ธ **WPF Visualization**
- **Interactive map viewer** with zoom, pan, and layer management
- **Rich UI controls** for spatial data display
- **Custom markers and annotations**

---

## ๐Ÿ—๏ธ Architecture

Maptor follows a modular architecture with clear separation of concerns:

```
Maptor/
โ”œโ”€โ”€ ๐Ÿ“ฆ IRI.Maptor.Sta/ # Core spatial operations & algorithms
โ”‚ โ”œโ”€โ”€ Spatial # Geometry types, spatial algorithms
โ”‚ โ”‚ โ”œโ”€โ”€ IO/ # Format I/O (DXF, SVG, EPS, TopoJSON, PMTiles, CesiumTerrain, etc.)
โ”‚ โ”‚ โ””โ”€โ”€ Analysis/ # Spatial analysis algorithms
โ”‚ โ”œโ”€โ”€ SpatialReferenceSystem # Coordinate systems & transformations
โ”‚ โ”œโ”€โ”€ ShapefileFormat # ESRI Shapefile I/O
โ”‚ โ”œโ”€โ”€ Ogc # OGC standards implementation
โ”‚ โ”œโ”€โ”€ Graph # Graph algorithms
โ”‚ โ”œโ”€โ”€ MachineLearning # ML algorithms for spatial data
โ”‚ โ”œโ”€โ”€ GeoParquet # GeoParquet format support
โ”‚ โ”œโ”€โ”€ Pdf # PDF vector format support
โ”‚ โ”œโ”€โ”€ Security # Security/cryptography primitives
โ”‚ โ””โ”€โ”€ Persistence # Persistence abstractions
โ”œโ”€โ”€ ๐Ÿ”ง IRI.Maptor.Ket/ # Infrastructure & persistence
โ”‚ โ”œโ”€โ”€ SqlServerPersistence # SQL Server integration
โ”‚ โ”œโ”€โ”€ PostgreSqlPersistence # PostGIS integration
โ”‚ โ”œโ”€โ”€ SqlitePersistence # SQLite/GeoPackage/MBTiles support
โ”‚ โ”œโ”€โ”€ PersonalGdbPersistence # Personal Geodatabase support
โ”‚ โ”œโ”€โ”€ GdiPlus # Raster data handling
โ”‚ โ””โ”€โ”€ WebApiPersistence # Web API data sources
โ”œโ”€โ”€ ๐Ÿ–ฅ๏ธ IRI.Maptor.Jab/ # WPF UI components
โ”‚ โ”œโ”€โ”€ Controls # Map viewer, dialogs
โ”‚ โ”œโ”€โ”€ Common # MVVM infrastructure
โ””โ”€โ”€ ๐Ÿงช Tests & Samples/ # Comprehensive test suite & examples
```

---

## ๐Ÿ“ฆ NuGet Packages

| Package | Description | Version |
|---------|-------------|---------|
| [IRI.Maptor.Sta.Spatial](https://www.nuget.org/packages/IRI.Maptor.Sta.Spatial) | Core spatial functionalities (GeoJSON, analysis, etc.) | ![NuGet](https://img.shields.io/nuget/v/IRI.Maptor.Sta.Spatial.svg?style=flat-square) |
| [IRI.Maptor.Sta.ShapefileFormat](https://www.nuget.org/packages/IRI.Maptor.Sta.ShapefileFormat) | Read/Write shapefile (shp, shx, dbf, prj, etc.) | ![NuGet](https://img.shields.io/nuget/v/IRI.Maptor.Sta.ShapefileFormat.svg?style=flat-square) |
| [IRI.Maptor.Sta.SpatialReferenceSystem](https://www.nuget.org/packages/IRI.Maptor.Sta.SpatialReferenceSystem) | Coordinate system transformations | ![NuGet](https://img.shields.io/nuget/v/IRI.Maptor.Sta.SpatialReferenceSystem.svg?style=flat-square) |
| [IRI.Maptor.Sta.Ogc](https://www.nuget.org/packages/IRI.Maptor.Sta.Ogc) | OGC standard implementations | ![NuGet](https://img.shields.io/nuget/v/IRI.Maptor.Sta.Ogc.svg?style=flat-square) |
| [IRI.Maptor.Sta.Graph](https://www.nuget.org/packages/IRI.Maptor.Sta.Graph) | Graph Algorithms (BFS, DFS, Dijkstra, etc.) | ![NuGet](https://img.shields.io/nuget/v/IRI.Maptor.Sta.Graph.svg?style=flat-square) |
| [IRI.Maptor.Jab.Controls](https://www.nuget.org/packages/IRI.Maptor.Jab.Controls) | WPF Map user controls | ![NuGet](https://img.shields.io/nuget/v/IRI.Maptor.Jab.Controls.svg?style=flat-square) |

โ–ถ Show more packages

| Package | Description | Version |
|---------|-------------|---------|
| [IRI.Maptor.Jab.Common](https://www.nuget.org/packages/IRI.Maptor.Jab.Common) | Basic UI models, rendering methods | ![NuGet](https://img.shields.io/nuget/v/IRI.Maptor.Jab.Common.svg?style=flat-square) |
| [IRI.Maptor.Ket.SqlServerPersistence](https://www.nuget.org/packages/IRI.Maptor.Ket.SqlServerPersistence) | SQL Server spatial integration | ![NuGet](https://img.shields.io/nuget/v/IRI.Maptor.Ket.SqlServerPersistence.svg?style=flat-square) |
| [IRI.Maptor.Ket.PostgreSqlPersistence](https://www.nuget.org/packages/IRI.Maptor.Ket.PostgreSqlPersistence) | PostGIS integration | ![NuGet](https://img.shields.io/nuget/v/IRI.Maptor.Ket.PostgreSqlPersistence.svg?style=flat-square) |
| [IRI.Maptor.Ket.SqlitePersistence](https://www.nuget.org/packages/IRI.Maptor.Ket.SqlitePersistence) | SQLite/GeoPackage/MBTiles support | ![NuGet](https://img.shields.io/nuget/v/IRI.Maptor.Ket.SqlitePersistence.svg?style=flat-square) |
| [IRI.Maptor.Sta.MachineLearning](https://www.nuget.org/packages/IRI.Maptor.Sta.MachineLearning) | Clustering, Apriori, Logistic Regression | ![NuGet](https://img.shields.io/nuget/v/IRI.Maptor.Sta.MachineLearning.svg?style=flat-square) |
| [IRI.Maptor.Sta.Pdf](https://www.nuget.org/packages/IRI.Maptor.Sta.Pdf) | PDF vector format support | ![NuGet](https://img.shields.io/nuget/v/IRI.Maptor.Sta.Pdf.svg?style=flat-square) |
| [IRI.Maptor.Sta.Common](https://www.nuget.org/packages/IRI.Maptor.Sta.Common) | Foundational utilities and abstractions | ![NuGet](https://img.shields.io/nuget/v/IRI.Maptor.Sta.Common.svg?style=flat-square) |

๐Ÿ‘‰ [Browse all packages on NuGet.org](https://www.nuget.org/packages?q=IRI.Maptor)

---

## ๐Ÿ’ป Code Examples

### Working with Shapefiles
```csharp
using IRI.Maptor.Extensions;
using IRI.Maptor.Sta.ShapefileFormat;

// Read shapefile
var shapes = await Shapefile.ReadShapesAsync("countries.shp");
foreach (var shape in shapes)
{
Console.WriteLine($"Country: {shape.AsSqlServerWkt()}");
}

// Convert to GeoJSON
var geoJson = shapes.Select(s => s.AsGeometry().AsGeoJson()).ToList();
```

### Coordinate Transformations
```csharp
using IRI.Maptor.Sta.Common.Primitives;
using IRI.Maptor.Sta.SpatialReferenceSystem;

// Transform WGS84 to UTM
var wgs84Point = new Point(51.5074, -0.1278); // London
var utmPoint = MapProjects.GeodeticToUTM(wgs84Point);

Console.WriteLine($"London (UTM): {utmPoint}");
```

---

## ๐ŸŽฏ Use Cases

- **๐Ÿ—บ๏ธ GIS Applications**: Desktop and web mapping applications
- **๐Ÿ“Š Data Analysis**: Spatial data processing and analysis
- **๐Ÿ—๏ธ Engineering**: Surveying, and infrastructure projects
- **๐Ÿš— Transportation**: Route optimization, logistics
- **๐Ÿ”ฌ Research**: Academic and scientific spatial research

---

## ๐Ÿš€ Getting Started

### 1. Clone & Build
```bash
git clone https://github.com/hosseinnarimanirad/Maptor.git
cd Maptor
dotnet build
```

### 2. Run Samples
```bash
# WPF Sample Application
cd samples/IRI.Maptor.Tag.SampleWpfApp
dotnet run

# Console Samples
cd samples/IRI.Maptor.Tag.SampleCodes
dotnet run
```

### 3. Explore Documentation
- ๐Ÿ“š [Full documentation and guides](https://github.com/hosseinnarimanirad/Maptor/wiki)
- ๐ŸŽ“ [Tutorial PDFs](docs/) - Step-by-step guides
- ๐Ÿ’ก [Sample applications](samples/) - Real-world examples

---

## ๐Ÿงช Testing & Quality

- **1,300+ C# files** with comprehensive test coverage
- **Unit tests** for core functionality
- **Performance benchmarks** for some algorithms
- **Continuous integration** with GitHub Actions

---

## ๐Ÿค Contributing

We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) and [Code of Conduct](CODE_OF_CONDUCT.md).

### Ways to Contribute
- ๐Ÿ› **Bug Reports** โ€“ Found an issue? Report it with steps to reproduce
- ๐Ÿ’ก **Feature Requests** โ€“ Got an idea? Open a discussion or issue
- ๐Ÿ”ง **Code Contributions** โ€“ Implement fixes, new features, or refactor for better performance
- ๐Ÿ“š **Documentation** โ€“ Improve README, tutorials, XML docs, or add usage examples
- ๐Ÿงช **Testing** โ€“ Write unit/integration tests to ensure quality

---

## ๐Ÿ“ˆ Performance

Maptor is designed for performance with:
- **Optimized algorithms** for large datasets
- **Spatial indexing** (KdTree, RTree) for fast queries
- **Memory-efficient** streaming APIs
- **Async/await** support for I/O operations
- **Parallel processing** where applicable

---

## ๐ŸŒ Internationalization

- **Multi-language support** with localization framework
- **RTL language support** (Arabic, Persian, Hebrew)
- **Regional data providers** (Iran-specific datasets)
- **Cultural formatting** for numbers, dates, and coordinates

---

## ๐Ÿ“œ License

Maptor is released under the [MIT License](LICENSE.txt) - see the LICENSE file for details.

---

## ๐Ÿ™ Acknowledgments

- Built with modern .NET technologies
- Inspired by OGC standards and best practices
- Community-driven development
- Academic research integration

---

**โญ Star this repository if you find it useful!**

[Report Bug](https://github.com/hosseinnarimanirad/Maptor/issues) ยท [Request Feature](https://github.com/hosseinnarimanirad/Maptor/issues) ยท [Join Discussion](https://github.com/hosseinnarimanirad/Maptor/discussions)