https://github.com/skybrud/skybrud.essentials.maps
.NET library for working with maps and geospatial data and geometry.
https://github.com/skybrud/skybrud.essentials.maps
geojson maps package skybrud skybrud-essentials wellknowntext
Last synced: 10 months ago
JSON representation
.NET library for working with maps and geospatial data and geometry.
- Host: GitHub
- URL: https://github.com/skybrud/skybrud.essentials.maps
- Owner: skybrud
- License: mit
- Created: 2019-04-27T15:18:49.000Z (about 7 years ago)
- Default Branch: v1/main
- Last Pushed: 2024-03-03T14:08:23.000Z (over 2 years ago)
- Last Synced: 2025-08-01T01:23:26.789Z (11 months ago)
- Topics: geojson, maps, package, skybrud, skybrud-essentials, wellknowntext
- Language: C#
- Homepage: https://packages.skybrud.dk/skybrud.essentials.maps/
- Size: 6.02 MB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Skybrud.Essentials.Maps
[](LICENSE.md)
Skybrud.Essentials.Maps is a .NET package for working with maps and geospatial data.
It also supports working with popular formats such as [**GeoJSON**](https://en.wikipedia.org/wiki/GeoJSON), [**KML**](https://en.wikipedia.org/wiki/Keyhole_Markup_Language) (Keyhole Markup Language) and [**WKT**](https://en.wikipedia.org/wiki/Well-known_text_representation_of_geometry) (Well Known Text).
### Installation
To install the Skybrud.Essentials.Maps, pick one of the methods below:
1. [**NuGet Package**][NuGetPackage]
Install this NuGet package in your Visual Studio project. Makes updating easy.
2. [**ZIP file**][GitHubRelease]
Grab a ZIP file of the latest release; unzip and move the `Skybrud.Essentials.Maps.dll`and other DLLs matching your target framework to the bin directory of your project.
### Dependencies
- [**Skybrud.Essentials**](https://github.com/skybrud/Skybrud.Essentials)
A package with logic for handling various common tasks in .NET.
- [**Json.NET**](https://github.com/jamesnk/newtonsoft.json)
Used for searializing/deserializing JSON.
- [**Skybrud.Essentials.Http**](https://github.com/skybrud/Skybrud.Essentials.Http)
HTTP package used for resolving network links in KML files.
### Found a bug? Have a question?
* Please feel free to [**create an issue**][Issues], and I will get back to you ;)
### Changelog
The [**releases page**][GitHubReleases] lists the relevant changes from each release.
### Usage
#### Geometry, lines and shapes
Define a point on a map:
```csharp
// Initialize a new point by latitude and longitude
IPoint point = new Point(55.708151, 9.536131);
```
Calculate the distance between two points:
```csharp
// Initialize the points by latitude and longitude
IPoint a = new Point(55.708151, 9.536131);
IPoint b = new Point(55.708069, 9.536000);
// Calculate the distance in metres
double distance = DistanceUtils.GetDistance(a, b);
```
Define a line on a map:
```csharp
// Initialize the points by latitude and longitude
IPoint a = new Point(55.708151, 9.536131);
IPoint b = new Point(55.708069, 9.536000);
// Initialize a new line from the two points
ILine line = new Line(a, b);
// Get the length of the line
double length = line.GetLength();
```
Define a line string (polyline) on a map:
```csharp
// Initialize the points by latitude and longitude
IPoint a = new Point(55.708151, 9.536131);
IPoint b = new Point(55.708069, 9.536000);
IPoint c = new Point(55.708061, 9.536172);
// Initialize a new line string from the multiple points
ILineString line = new LineString(a, b, c);
// Get the length of the line string
double length = line.GetLength();
```
Define a polygon on a map:
```csharp
// Initialize the points by latitude and longitude
IPoint a = new Point(55.708151, 9.536131);
IPoint b = new Point(55.708069, 9.536000);
IPoint c = new Point(55.708061, 9.536172);
IPoint d = new Point(55.708145, 9.536222);
IPoint f = new Point(55.708113, 9.536086);
// Initialize a new polygon from the multiple points
IPolygon polygon = new Polygon(a, b, c, d, a);
// Get the circumferences of the polygon
double circumference = polygon.GetCircumference();
// Get the area of the polygon
double area = polygon.GetArea();
// Get the bounding of the polygon
IRectangle bbox = polygon.GetBoundingBox();
// Does the polygon contain point "f"?
bool contains = polygon.Contains(f);
```
[NuGetPackage]: https://www.nuget.org/packages/Skybrud.Essentials.Maps
[GitHubRelease]: https://github.com/skybrud/Skybrud.Essentials.Maps/releases/latest
[GitHubReleases]: https://github.com/skybrud/Skybrud.Essentials.Maps/releases
[Changelog]: https://github.com/skybrud/Skybrud.Essentials.Maps/releases
[Issues]: https://github.com/skybrud/Skybrud.Essentials.Maps/issues