.N .NET Landscape

Geo

Media, Charts & Geospatial
github.com/sibartlett/Geo

A geospatial library for .NET

GitHub stars
194
Forks
41
Open issues
6
NuGet downloads
7,961,478
latest 3.0.1
License
LGPL-3.0
Language
C#
Last push
5 days ago
19 Oct 2026
Created
25 Aug 2012

Geo

Geo — a geospatial library for .NET

NuGet Downloads License: LGPL-3.0-or-later

Geo is a spatial library for .NET built specifically for geographic data — coordinates on the surface of the Earth — rather than planar/projected data. It provides geometry and GPS types, serializers for common spatial and GPS file formats, and geodetic and geomagnetic calculations.

Wondering how it compares to NetTopologySuite? See Geo vs. NetTopologySuite.

Documentation · Changelog · Issues · NuGet

Contents

Installation

Geo targets .NET Standard 2.0, so it runs on .NET 5+, .NET Core 2.0+, and .NET Framework 4.6.1+. Install it from NuGet:

dotnet add package Geo

Quick start

using Geo;
using Geo.Geometries;
using Geo.Geodesy;
using Geo.IO.Wkt;
using Geo.IO.GeoJson;
using Geo.Measure;

// Ordinate order is latitude, longitude — all ordinates are in degrees.
var london = new Coordinate(51.5074, -0.1278);
var newYork = new Coordinate(40.7128, -74.0060);

// Distance and bearing along the great-circle (shortest) line.
GeodeticLine line = london.CalculateShortestLine(newYork);
double km = line.Distance.ConvertTo(DistanceUnit.Km).Value;   // ~5570 km
double initialBearing = line.Bearing12;                       // degrees

// Serialize a geometry to WKT and GeoJSON.
var point = new Point(london);
string wkt = new WktWriter().Write(point);                    // "POINT (-0.1278 51.5074)"
string geoJson = new GeoJsonWriter().Write(point);

// Parse it back from WKT.
IGeometry parsed = new WktReader().Read(wkt);

Features

Geometry types

  • Point
  • LineString, LinearRing
  • Polygon, Triangle
  • Circle
  • GeometryCollection, MultiPoint, MultiLineString, MultiPolygon

Coordinates come in four flavours: Coordinate (lat/lon), CoordinateZ (with elevation), CoordinateM (with a measure), and CoordinateZM (both).

GPS types

  • GpsData, Route, Track, Waypoint

Serialize / deserialize geometries

Format Read Write
WKT (Well-Known Text) ✓ ✓
WKB (Well-Known Binary) ✓ ✓
GeoJSON ✓ ✓

Don't know a string's format up front? GeoFormat.Detect / GeoFormat.TryParse sniff whether it is a coordinate pair, WKT, or GeoJSON and parse it — see the parsing guide.

Serialize / deserialize GPS files

Format Read Write
GPX (1.0 & 1.1) ✓ ✓
NMEA ✓
IGC ✓
Garmin flightplan ✓
SkyDemon flightplan ✓
PocketFMS flightplan ✓

Links are read and written for both versions - GpsData, Waypoint, Route and Track each expose a Links collection of GpsLink (href, text, media type). GPX 1.1 allows any number; GPX 1.0 has a single <url>/<urlname> pair, so writing 1.0 keeps the first.

GPX extensions are read and written for both versions, so vendor content such as Garmin's gpxx or the Topografix gpx_style line styling survives a round-trip. GpsData, Track, TrackSegment, Route and Waypoint each expose the foreign content of their element as XElements:

XNamespace style = "http://www.topografix.com/GPX/gpx_style/0/2";

var colour = data.Tracks[0]
    .Extensions.FirstOrDefault(x => x.Name == style + "line")
    ?.Element(style + "color")?.Value;

Geographic calculations

  • Distance and bearing
  • Area
  • Great-circle lines
  • Rhumb lines

Geomagnetism calculations

  • IGRF and WMM models (through 2025)
  • Declination, inclination, intensity, and more

Conventions

  • All ordinates are in degrees, unless specified otherwise.
  • All measurements are in S.I. units (metres, seconds, etc.), unless specified otherwise.
  • The coordinate reference system is assumed to be WGS-84.
  • Ordinate order in constructors is latitude, longitude (e.g. new Coordinate(lat, lon)).

Building from source

The project uses NUKE for build automation. Use the bootstrap scripts, which pin the SDK and run the same targets as CI:

./build.sh            # compile (default target)
./build.sh Test       # build and run tests

On Windows, use build.cmd / build.ps1. See AGENTS.md for a full description of the repository layout, build targets, and coding conventions.

Contributing

Issues and pull requests are welcome. Formatting is enforced by CSharpier and checked in CI — run dotnet csharpier format . before committing (a pre-commit hook does this for staged files). New library code must remain compatible with .NET Standard 2.0.

License

Geo is licensed under the terms of the GNU Lesser General Public License, version 3 or later (LGPL-3.0-or-later), as published by the Free Software Foundation. See LICENSE for details.