Skip to content

Commit c66da2a

Browse files
committed
added readme for nuget, updated reference from csproj
1 parent d74704a commit c66da2a

2 files changed

Lines changed: 80 additions & 1 deletion

File tree

src/PolylineAlgorithm/PolylineAlgorithm.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
</PropertyGroup>
3333

3434
<ItemGroup>
35-
<None Include="..\..\README.md">
35+
<None Include=".\README.md">
3636
<Pack>True</Pack>
3737
<PackagePath>\</PackagePath>
3838
</None>

src/PolylineAlgorithm/README.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# PolylineAlgorithm for .NET
2+
3+
A modern, fully compliant Google Encoded Polyline Algorithm library for .NET Standard 2.1+, supporting strong input validation, extensibility for custom coordinate types, and robust performance.
4+
5+
## Features
6+
7+
- Google-compliant polyline encoding/decoding for geographic coordinates
8+
- Immutable, strongly-typed data structures: `Coordinate`, `Polyline`
9+
- Predefined encoder/decoder types for easy usage
10+
- Extensible APIs for custom coordinate and polyline types
11+
- Robust input validation and descriptive exceptions
12+
- Configurable with `PolylineEncodingOptions` (buffer, logging, etc.)
13+
- Thread-safe, stateless APIs
14+
- Benchmarks and unit tests for correctness and performance
15+
- Auto-generated API docs ([API Reference](https://petesramek.github.io/polyline-algorithm-csharp/))
16+
- Supports .NET Core, .NET 5+, Xamarin, Unity, Blazor via `netstandard2.1`
17+
18+
## Installation
19+
20+
```shell
21+
dotnet add package PolylineAlgorithm
22+
```
23+
24+
or via NuGet PMC:
25+
26+
```powershell
27+
Install-Package PolylineAlgorithm
28+
```
29+
30+
## Quick Start
31+
32+
### Encode coordinates
33+
34+
```csharp
35+
using PolylineAlgorithm;
36+
37+
var coordinates = new List<Coordinate>
38+
{
39+
new Coordinate(48.858370, 2.294481),
40+
new Coordinate(51.500729, -0.124625)
41+
};
42+
43+
var encoder = new PolylineEncoder();
44+
Polyline encoded = encoder.Encode(coordinates);
45+
46+
Console.WriteLine(encoded.ToString()); // Print encoded polyline string
47+
```
48+
49+
### Decode polyline
50+
51+
```csharp
52+
using PolylineAlgorithm;
53+
54+
var decoder = new PolylineDecoder();
55+
Polyline polyline = Polyline.FromString("yseiHoc_MwacOjnwM");
56+
IEnumerable<Coordinate> decoded = decoder.Decode(polyline);
57+
```
58+
59+
## Advanced Usage
60+
61+
- Custom coordinate/polyline types are supported via `AbstractPolylineEncoder` and `AbstractPolylineDecoder`.
62+
- Additional configuration via `PolylineEncodingOptionsBuilder`.
63+
64+
> See [API Reference](https://petesramek.github.io/polyline-algorithm-csharp/) for full documentation.
65+
66+
## FAQ
67+
68+
- **What coordinate ranges are valid?**
69+
Latitude: -90..90, Longitude: -180..180 (throws `ArgumentOutOfRangeException` for invalid input)
70+
- **What .NET versions are supported?**
71+
Any environment supporting `netstandard2.1`
72+
- **How do I customize encoder options?**
73+
Use `PolylineEncodingOptionsBuilder` and pass to the encoder constructor.
74+
- **Where can I get help?**
75+
[GitHub issues](https://github.com/petesramek/polyline-algorithm-csharp/issues)
76+
77+
## License
78+
79+
MIT License © Pete Sramek

0 commit comments

Comments
 (0)