A Geospatial Library for .NET - a .NET port of spatial4j
$ dotnet add package Spatial4nSpatial4n is a general purpose spatial / geospatial library for .NET, a direct port of the spatial4j Java library. Its core capabilities are:
When working with grid square indexing schemes, you will likely to find something especially useful in Spatial4n.
The main part of Spatial4n is its collection of shapes. Shapes in Spatial4n have these features:
Contains, Within, Disjoint, Intersects. Note that Spatial4n doesn't have a notion of "touching".Spatial4n has a variety of shapes that operate in Euclidean-space -- i.e. a flat 2D plane. Most shapes are augmented to support a wrap-around at X -180/+180 for compatibility with latitude & longitudes, which is effectively a cylindrical model. But the real bonus is its circle (i.e. point-radius shape that can operate on a surface-of-a-sphere model. See below for further info. The term "geodetic" or "geodesic" or "geo" is used here as synonymous with that model but technically those words have a more broad meaning.
| Shape | Euclidean |
|---|
| Cylindrical |
|---|
| Spherical |
|---|
| Point | Y | Y | Y |
| Rectangle | Y | Y | Y |
| Circle | Y | N | Y |
| LineString | Y | N | N |
| Buffered L/S | Y | N | N |
| Polygon | Y | Y | N |
| ShapeCollection | Y | Y | Y |
Geometry, which is to say that most of the fundamental logic for that shape is implemented by NTS.Currently, the best sources of documentation are the Spatial4j javadocs and the Spatial4j Getting Started section.
To build the project from source, see the Building and Testing documentation.
If you find this library to be useful, please star us on GitHub and consider a financial sponsorship so we can continue bringing you great free tools like this one.