RedCorners.Components.CoordsWords 5.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package RedCorners.Components.CoordsWords --version 5.1.0                
NuGet\Install-Package RedCorners.Components.CoordsWords -Version 5.1.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="RedCorners.Components.CoordsWords" Version="5.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add RedCorners.Components.CoordsWords --version 5.1.0                
#r "nuget: RedCorners.Components.CoordsWords, 5.1.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 RedCorners.Components.CoordsWords as a Cake Addin
#addin nuget:?package=RedCorners.Components.CoordsWords&version=5.1.0

// Install RedCorners.Components.CoordsWords as a Cake Tool
#tool nuget:?package=RedCorners.Components.CoordsWords&version=5.1.0                

Convert map coordinates to a sequence of words and back.

NuGet: https://www.nuget.org/packages/RedCorners.Components.CoordsWords

GitHub: https://github.com/samafshari/RedCorners.Components.CoordsWords

Getting Started

Install the NuGet and use the RedCorners.Components namespace:

using RedCorners.Components;

You can convert a pair of latitude and longitudes to a sequence of words (space-delimited) like this:

string sequence = new CoordsWords(latitude, longitude).ToString();

You can convert back the sequence of words to the coordinates like this:

var coordsWords = new CoordsWords(sequence);
var latitude = coordsWords.Latitude;
var longitude = coordsWords.Longitude;

By default, the library comes with a list of English words. You can use an arbitrary array of strings instead of the default index. There are no limitations to what you can use, other than having more than one entries, and no repetitions:

var lines = File.ReadAllLines("words.txt");
string sequence = new CoordsWords(latitude, longitude, lines).ToString();

The more words in your index file, the less words the output sequence will have. The default index results in sequences with four words.

It is strongly recommended to use a custom index file, as the default index may change between releases, resulting in changes in the outputted sequence for a given input.

Example

Input:  1, 1
Words:  canadian provides certification one
Back:   1.0000, 1.0000
---
Input:  0, 0
Words:  designing reached proposed one
Back:   0.0000, 0.0000
---
Input:  -90, -180
Words:  prefers envelope warranty more
Back:   -90.0000, -180.0000
---
Input:  90, 180
Words:  accessibility rays marketing use
Back:   90.0000, 180.0000
---
Input:  -90, 180
Words:  guarantee boulder warranty more
Back:   -90.0000, 180.0000
---
Input:  90, -180
Words:  archives giants marketing use
Back:   90.0000, -180.0000
---
Input:  59.3232, 18.0757
Words:  deaths firmware two which
Back:   59.3232, 18.0757
---
Input:  59.32323232, 18.0757757757
Words:  deaths firmware two which
Back:   59.3232, 18.0757
using RedCorners.Components;

static void Main(string[] args)
{
    var testPoints = new[]
    {
        (1.0, 1.0),
        (0.0, 0.0),
        (-90.0, -180.0),
        (90.0, 180.0),
        (-90.0, 180.0),
        (90.0, -180.0),
        (59.3232,18.0757),
        (59.32323232,18.0757757757)
    };

    foreach (var p in testPoints)
    {
        Console.WriteLine($"Input:\t{p.Item1}, {p.Item2}");
        var coordsWords = new CoordsWords(p.Item1, p.Item2).ToString();
        Console.WriteLine($"Words:\t{coordsWords}");

        var reverse = new CoordsWords(coordsWords.ToString());
        Console.WriteLine($"Back:\t{reverse.Latitude:N4}, {reverse.Longitude:N4}");
        Console.WriteLine("---");
    }
}
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
5.10.0 734 12/31/2019
5.9.0 485 12/18/2019
5.8.0 478 11/29/2019
5.7.0 493 11/29/2019
5.6.0 485 11/21/2019
5.5.0 474 11/20/2019
5.4.0 485 11/20/2019
5.3.0 480 11/20/2019
5.2.0 475 11/16/2019
5.1.0 465 11/16/2019

Convert map coordinates to a sequence of words and back.