Polyliner.Net 1.0.2

Simple Google Maps Polyline encoder/decoder.

Requires NuGet 2.8.3 or higher.

Install-Package Polyliner.Net -Version 1.0.2
dotnet add package Polyliner.Net --version 1.0.2
<PackageReference Include="Polyliner.Net" Version="1.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Polyliner.Net --version 1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Polyliner.NET

Simple Google Maps Polyline encoder/decoder.

https://developers.google.com/maps/documentation/utilities/polylinealgorithm

Usage

Encode Points:

var polyliner = new Polyliner();
var points = new List<PolylinePoint> 
{
    new PolylinePoint(latitude: 52.22778, longitude: 20.98614), 
    new PolylinePoint(latitude: 52.22555, longitude: 20.98725)
};

var result = polyliner.Encode(points); 

Console.WriteLine(result); // "svw}Hkza_C|L}E"

Decode Polyline:

var polyliner = new Polyliner();
var polyline = "svw}Hkza_C|L}E";

var result = polyliner.Decode(polyline);

Console.WriteLine(result[0].Latitude.ToString("0.00000", CultureInfo.InvariantCulture));  // "52.22778"
Console.WriteLine(result[0].Longitude.ToString("0.00000", CultureInfo.InvariantCulture)); // "20.98614"
Console.WriteLine(result[1].Latitude.ToString("0.00000", CultureInfo.InvariantCulture));  // "52.22555"
Console.WriteLine(result[1].Longitude.ToString("0.00000", CultureInfo.InvariantCulture)); // "20.98725"

Polyliner.NET

Simple Google Maps Polyline encoder/decoder.

https://developers.google.com/maps/documentation/utilities/polylinealgorithm

Usage

Encode Points:

var polyliner = new Polyliner();
var points = new List<PolylinePoint> 
{
    new PolylinePoint(latitude: 52.22778, longitude: 20.98614), 
    new PolylinePoint(latitude: 52.22555, longitude: 20.98725)
};

var result = polyliner.Encode(points); 

Console.WriteLine(result); // "svw}Hkza_C|L}E"

Decode Polyline:

var polyliner = new Polyliner();
var polyline = "svw}Hkza_C|L}E";

var result = polyliner.Decode(polyline);

Console.WriteLine(result[0].Latitude.ToString("0.00000", CultureInfo.InvariantCulture));  // "52.22778"
Console.WriteLine(result[0].Longitude.ToString("0.00000", CultureInfo.InvariantCulture)); // "20.98614"
Console.WriteLine(result[1].Latitude.ToString("0.00000", CultureInfo.InvariantCulture));  // "52.22555"
Console.WriteLine(result[1].Longitude.ToString("0.00000", CultureInfo.InvariantCulture)); // "20.98725"

Release Notes

# 1.0.2 Fixed bug https://github.com/sglogowski/Polyliner.NET/issues/1

# 1.0.1.1 Code cleanup, renamed Position to PolylinePoint, added initial size for PolylinePoints list.

# 1.0.1 Missing dll...

# 1.0.0 Initial version.

  • .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 History

Version Downloads Last updated
1.0.2 78 11/11/2020
1.0.1.1 487 5/29/2019