Ca.Pranavpatel.Algo.GridPointCode 1.0.0

dotnet add package Ca.Pranavpatel.Algo.GridPointCode --version 1.0.0
                    
NuGet\Install-Package Ca.Pranavpatel.Algo.GridPointCode -Version 1.0.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="Ca.Pranavpatel.Algo.GridPointCode" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Ca.Pranavpatel.Algo.GridPointCode" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Ca.Pranavpatel.Algo.GridPointCode" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Ca.Pranavpatel.Algo.GridPointCode --version 1.0.0
                    
#r "nuget: Ca.Pranavpatel.Algo.GridPointCode, 1.0.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.
#:package Ca.Pranavpatel.Algo.GridPointCode@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Ca.Pranavpatel.Algo.GridPointCode&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Ca.Pranavpatel.Algo.GridPointCode&version=1.0.0
                    
Install as a Cake Tool

Grid Point Code (GPC)

Overview

Grid Point Code (GPC) is a global geocoding system that provides a unique, lossless, and compact alphanumeric code for any geographic location (home, office, or other places). It enables precise identification and offline conversion between geographic coordinates and codes.

Features

  • Unique Global Identification: Every location receives a unique code.
  • Lossless Encoding & Decoding: Convert between latitude/longitude and GPC without loss of precision (up to 5 decimal places).
  • Offline Conversion: No network required for encoding or decoding.
  • Easy-to-Read Format: Codes are formatted as #xxxx-xxxx-xxx for clarity.
  • Proximity Awareness: Similar codes represent nearby locations.
  • Open Source: Freely available for use and modification.

How It Works

  • Encoding: Converts latitude and longitude into a unique 11-character code using a custom base-27 alphabet.
  • Decoding: Recovers the original coordinates from a GPC.
  • Validation: Ensures input coordinates and codes are within valid ranges.
  • Formatting: Provides formatted and unformatted code representations.

Usage

Encoding Coordinates

using Ca.Pranavpatel.Algo.GridPointCode;

// Encode latitude and longitude to GPC
string gpc = GPC.Encode(43.65000, -79.38000); // Toronto
// Output: #FN5G-CDKL-HDC

Decoding a GPC

using Ca.Pranavpatel.Algo.GridPointCode;

// Decode GPC to latitude and longitude
(double lat, double lng) = GPC.Decode("#FN5G-CDKL-HDC");

Validation

(bool isValid, string message) = GPC.IsValid("#FN5G-CDKL-HDC");

Format

  • Code Structure: #xxxx-xxxx-xxx (11 alphanumeric characters)
  • Alphabet: Uses base-27 characters: CDFGHJKLMNPRTVWXY0123456789
  • Precision: Up to 5 decimal places for coordinates

License

Licensed under the Apache License, Version 2.0.

Contributing

Contributions are welcome! Please submit issues or pull requests via GitHub.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.0.0 362 7/21/2025
0.0.1.2 346 11/12/2023
0.0.1.1 135 11/12/2023
0.0.1 167 10/26/2023