Skip to main content

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.

Project description

Grid Point Code (GPC) – Python

Overview

Grid Point Code (GPC) is a geocoding system that provides a unique, compact, and lossless alphanumeric code for any global geographic location. This Python implementation allows offline encoding and decoding between latitude/longitude coordinates and GPCs with high precision.

Features

  • Unique Global Codes: Every location is mapped to a unique alphanumeric string.
  • Lossless Bi-directional Conversion: Accurate up to 5 decimal places.
  • Offline Functionality: No network access required.
  • Formatted Output: Standardized format: #XXXX-XXXX-XXX.
  • Proximity Awareness: Similar codes correspond to nearby locations.
  • Open Source: Available under the Apache License 2.0.

How It Works

  • Encoding: Converts latitude and longitude into an 11-character base-27 alphanumeric code.
  • Decoding: Converts a GPC string back to geographic coordinates.
  • Validation: Ensures coordinates and codes fall within valid ranges.
  • Formatting: Adds visual separators to GPCs for readability.

Installation

Install from PyPI:

pip install gridpointcode-algo-pranavpatel-ca

Usage

Encoding Coordinates

from gridpointcode_algo_pranavpatel_ca import GPC

# Encode latitude and longitude into GPC
gpc_code = GPC.encode(43.65000, -79.38000)  # Toronto
print(gpc_code)  # Output: #FN5G-CDKL-HDC

Decoding a GPC

# Decode GPC into latitude and longitude
lat, lng = GPC.decode("#FN5G-CDKL-HDC")
print(lat, lng)

Validating a GPC

# Validate GPC format and range
valid, message = GPC.is_valid_gpc("#FN5G-CDKL-HDC")
print(valid, message)

Code Format

  • GPC Structure: #XXXX-XXXX-XXX (11 base-27 characters)
  • Alphabet: "CDFGHJKLMNPRTVWXY0123456789" (base-27)
  • Precision: Approx. 5 decimal places in latitude/longitude

License

Licensed under the Apache License, Version 2.0.

Contributing

Contributions are welcome! Feel free to open issues or submit pull requests on GitHub.

Project details


Release history Release notifications | RSS feed

This version

1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gridpointcode_algo_pranavpatel_ca-1.0.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gridpointcode_algo_pranavpatel_ca-1.0-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file gridpointcode_algo_pranavpatel_ca-1.0.tar.gz.

File metadata

File hashes

Hashes for gridpointcode_algo_pranavpatel_ca-1.0.tar.gz
Algorithm Hash digest
SHA256 3df41d3f97cde8643a3b436b65114b8e5afd41baff935f5ef51e8d6ad9947048
MD5 470e4ec9ea73d960a246b07cb240268a
BLAKE2b-256 a688b02c7ec3ed7d84ef8bbdbe8519c664bd898c01fb9ea87943cbdba8b5ce07

See more details on using hashes here.

File details

Details for the file gridpointcode_algo_pranavpatel_ca-1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for gridpointcode_algo_pranavpatel_ca-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1bb4cf6f9e48b119bf101cde88fc28b1a0f9c39777c1303a3b9638533e8dd700
MD5 988a39ee54dbe6f15808c7e9114ec71e
BLAKE2b-256 b7a48475f69b4df8586b1353a44ae518c97b1c68384f4553e4cea717ce60977f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page