SharpSpatial 1.0.2
dotnet add package SharpSpatial --version 1.0.2
NuGet\Install-Package SharpSpatial -Version 1.0.2
<PackageReference Include="SharpSpatial" Version="1.0.2" />
<PackageVersion Include="SharpSpatial" Version="1.0.2" />
<PackageReference Include="SharpSpatial" />
paket add SharpSpatial --version 1.0.2
#r "nuget: SharpSpatial, 1.0.2"
#addin nuget:?package=SharpSpatial&version=1.0.2
#tool nuget:?package=SharpSpatial&version=1.0.2
SharpSpatial
SharpSpatial is a lightweight geospatial library for .NET, built as a modern alternative to SqlGeography
and SqlGeometry
, with full support for .NET Core and custom geodesic calculations written entirely in C#.
It combines the power of NetTopologySuite, GeoAPI, and ProjNET4GeoAPI for planar operations, while offering accurate geodesic calculations (Haversine and Vincenty) and basic projection capabilities (Spherical Mercator).
✨ Why use SharpSpatial?
- ✅ Pure .NET Core – no dependency on SQL Server or legacy types.
- ✅ Custom geodesic engine – Vincenty & Haversine distance, buffering, and more.
- ✅ Planar geometry support – thanks to NetTopologySuite.
- ✅ Mercator projection – convert from/to spherical Mercator (EPSG:3857).
- ✅ Developer-friendly – clean API, easy integration.
⚠️ Limitations
While useful in many real-world applications, SharpSpatial is not a full GIS engine.
Here’s what it doesn’t do (yet):
- ❌ No support for arbitrary coordinate reference systems (CRS)
- ❌ Limited projections (only WGS84 and Mercator)
- ❌ Simplified geometry model (common types only)
Still, for many server-side or data-processing tasks, it offers exactly what’s needed — with minimal overhead.
📦 Installation
Via NuGet:
dotnet add package SharpSpatial
🚀 Quick Start
using SharpSpatial;
// Prepare some WKT to parse
string squareWKT = "POLYGON((5 65, 25 65, 25 85, 5 85, 5 65))";
string pointH_WKT = "POINT(0 75)";
string pointV_WKT = "POINT(15 88)";
// Create a square and two points
SharpGeography square = new(squareWKT, 4326, false);
SharpGeography pointH = new(pointH_WKT, 4326, false);
SharpGeography pointV = new(pointV_WKT, 4326, false);
// Get the shortest line from the left point to the square (the point will fall in the middle of the vertical side of the square)
SharpGeography? shortestLineH = pointH.GetShortestLineTo(square);
string? shortestLineH_WKT = shortestLineH?.ToWKT();
/// Get the shortest line from the top point to the square (this time, the horizontal side of the square is not a straight line)
SharpGeography? shortestLineV = pointV.GetShortestLineTo(square);
string? shortestLineV_WKT = shortestLineV?.ToWKT();
// Create a geodesic buffer
string testWKT = "POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))";
SharpGeography test = new(testWKT, 4326, false);
var buffer = test.Buffer(500000).ToWKT(8);
🧭 Use Cases
- Accurate distance and area calculations over the ellipsoid
- Buffering and manipulating spatial shapes
- Migrating from
SqlGeography
in .NET Core apps - Lightweight geospatial features for APIs and services
❤️ Support SharpSpatial
I develop and maintain SharpSpatial in my free time, focusing on practical tools I use myself in the real world.
If you find this project useful, please consider sponsoring me on GitHub.
Even a small donation helps me keep the library maintained, improved, and open for everyone.
🛣 Roadmap
- GeoJSON input/output utilities
- Unit testing improvements
Have an idea or feedback? Open an issue or start a discussion.
📄 License
Licensed under the MIT License – free to use, modify, and distribute.
Third-party licenses
SharpSpatial uses the following third-party libraries:
- NetTopologySuite, licensed under the BSD-2-Clause license.
- ProjNET4GeoAPI, licensed under the BSD-2-Clause license.
These libraries retain their respective licenses.
Accurate geospatial logic for .NET, without the overhead.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- GeoAPI (>= 1.7.5)
- NetTopologySuite (>= 2.6.0)
- NetTopologySuite.IO.GeoJSON (>= 4.0.0)
- ProjNET4GeoAPI (>= 1.4.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Initial release of SharpSpatial.