Contains classes and methods that facilitate geography and geometry spatial operations. Targets .NET 8 or above. OData .NET library is open source at http://github.com/OData/odata.net. Documentation for the library can be found at https://docs.microsoft.com/en-us/odata/.
$ dotnet add package Microsoft.SpatialThe Microsoft.Spatial library provides classes and methods for geographic and geometric operations. It is a core component of the OData .NET libraries, enabling you to work with geospatial data types such as points in 2D/3D space, lat/long, lines, and polygons.
You can install the Microsoft.Spatial package via NuGet:
dotnet add package Microsoft.Spatial
Or via the NuGet Package Manager Console:
Install-Package Microsoft.Spatial
Here's a simple example of how to create and use spatial data types with Microsoft.Spatial:
using Microsoft.Spatial;
// Create a GeographyPoint
var point = GeographyPoint.Create(47.6097, -122.3331);
// Output the point's coordinates
Console.WriteLine($"Latitude: {point.Latitude}, Longitude: {point.Longitude}");
// Create a GeographyLineString
var lineString = GeographyFactory.LineString()
.LineTo(47.6097, -122.3331)
.LineTo(47.6205, -122.3493)
.Build();
// Output the line string's points
foreach (var position in lineString.Points)
{
Console.WriteLine($"Point: Latitude {position.Latitude}, Longitude {position.Longitude}");
}
For more detailed information, please refer to the official documentation.
There are many ways for you to contribute to OData .NET. The easiest way is to participate in discussion of features and issues. You can also contribute by sending pull requests of features or bug fixes to us. Contribution to the documentations is also highly welcomed. Please refer to the CONTRIBUTING.md for more details.
Security issues and bugs should be reported privately, via email, to the Microsoft Security Response Center (MSRC) secure@microsoft.com. You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Further information, including the MSRC PGP key, can be found in the .
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.