Knapp.Coordinate 1.2.0

dotnet add package Knapp.Coordinate --version 1.2.0
NuGet\Install-Package Knapp.Coordinate -Version 1.2.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Knapp.Coordinate" Version="1.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Knapp.Coordinate --version 1.2.0
#r "nuget: Knapp.Coordinate, 1.2.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Knapp.Coordinate as a Cake Addin
#addin nuget:?package=Knapp.Coordinate&version=1.2.0

// Install Knapp.Coordinate as a Cake Tool
#tool nuget:?package=Knapp.Coordinate&version=1.2.0

Knapp Coordinate API

The coordinate namespace provides classes and utilities for working with geographic coordinates.

Classes

Coordinate

Represents a geographic coordinate.

Properties
  • Latitude: The angular distance of a point on Earth's surface north or south of the equator, in decimal degrees.
  • Longitude: The angular distance of a point on Earth's surface east or west of the prime meridian, in decimal degrees.
  • LatitudeString: A string representation of the latitude value.
  • LongitudeString: A string representation of the longitude value.
Constructors
  • Coordinate(double latitude, double longitude): Initializes a new instance of the Coordinate class with the specified latitude and longitude values.
Methods
  • ToString(): Converts the coordinate to a string representation.
  • ToString(Format format): Converts the coordinate to a string representation using the specified format.
  • Clone(): Creates a clone of the coordinate object.
  • ToMetres(): Converts the coordinate to a projected coordinate system represented in meters.
  • FromMetres(double x, double y): Converts a projected coordinate system represented in meters to a geographic coordinate.
  • GetDistanceTo(Coordinate target, Earth.Model earthModel): Calculates the geodesic distance to a target coordinate.
  • GetBearingTo(Coordinate target, Earth.Model earthModel): Calculates the bearing from the current coordinate to a target coordinate.

Coordinate.Format

Represents different coordinate formats.

  • DD: Decimal degrees format.
  • DDM: Degrees and decimal minutes format.
  • DMS: Degrees, minutes, and seconds format.
  • UTM: Universal Transverse Mercator (UTM) format.
  • MGRS: Military Grid Reference System (MGRS) format.

Usage

To use the coordinate namespace, you need to import the coordinate.Formats namespace and create an instance of the Coordinate class:

using coordinate.Formats;
using System;

namespace YourNamespace
{
    public class YourClass
    {
        public static void Main()
        {
            Coordinate coordinate = new Coordinate(40.7128, -74.0060);
            Console.WriteLine(coordinate.ToString()); // Output: 40.7128�, -74.0060�
        }
    }
}

You can convert the coordinate to different formats using the ToString method:

Coordinate coordinate = new Coordinate(40.7128, -74.0060);
Console.WriteLine(coordinate.ToString(Format.DDM)); // Output: 40� 42.768', -74� 0.360'

You can also perform calculations such as getting the distance to a target coordinate:

Coordinate coordinate1 = new Coordinate(40.7128, -74.0060);
Coordinate coordinate2 = new Coordinate(34.0522, -118.2437);
double distance = coordinate1.GetDistanceTo(coordinate2);
Console.WriteLine(distance); // Output: 3939129.33567856 meters

For more information on the available methods and properties, refer to the documentation of each class and method.

That's it! You now have an overview of the coordinate namespace and how to use it in your applications.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.2.0 274 10/21/2023
1.1.0 138 6/19/2023
1.0.1 138 6/19/2023
1.0.0 137 6/19/2023