Skip to main content

Convert GPS coordinates to memorable hex addresses using H3

Project description

Hex Address - Python Package

PyPI version Python 3.8+ License: MIT

Convert GPS coordinates to memorable syllable addresses like je-ma-su-cu|du-ve-gu-ba with ~0.5 meter precision using spatially optimized H3 indexing.

🚀 Quick Start

pip install hex-address
from hex_address import H3SyllableSystem

# Initialize system (uses default ascii-fqwfmd config)
system = H3SyllableSystem()

# Convert coordinates to syllable address  
address = system.coordinate_to_syllable(48.8566, 2.3522)
print(address)  # "je-ma-su-cu|du-ve-gu-ba"

# Convert back to coordinates
lat, lon = system.syllable_to_coordinate(address)
print(f"{lat:.6f}, {lon:.6f}")  # 48.856602, 2.352198

# Validate addresses (some combinations don't exist)
if system.is_valid_syllable_address(address):
    print("Valid address!")

🛠️ Command Line Interface

# Convert coordinates to syllable address
hex-address coordinate 48.8566 2.3522

# Convert syllable address to coordinates  
hex-address syllable "je-ma-su-cu|du-ve-gu-ba"

# Validate an address
hex-address validate "je-ma-su-cu|du-ve-gu-ba"

# List available configurations
hex-address configs

# Use specific configuration
hex-address --config ascii-cjbnb coordinate 48.8566 2.3522

📋 Features

  • Sub-meter precision (~0.5m) using H3 Level 15
  • Spatially optimized with perfect Hamiltonian path (100% adjacency)
  • Memorable addresses using pronounceable syllables
  • Geographic similarity - nearby locations share syllable prefixes like postal codes
  • Perfect reversibility for all real coordinates
  • Dynamic formatting with pipe separators for readability
  • Multiple configurations optimized for different use cases
  • Pure ASCII letters for universal compatibility
  • CLI tool for easy integration

🎯 Configuration Options

Choose from multiple configurations based on your needs:

# Full ASCII alphabet (21 consonants, 5 vowels, 8 syllables)
system = H3SyllableSystem('ascii-fqwfmd')  # Default

# Minimal balanced (10 consonants, 5 vowels, 9 syllables) 
system = H3SyllableSystem('ascii-cjbnb')

# Japanese-friendly (no L/R confusion)
system = H3SyllableSystem('ascii-fqwclj')

# List all available configurations
from h3_syllable import list_available_configs
print(list_available_configs())

🌍 Use Cases

  • Emergency services: Share precise locations memorably
  • Logistics: Human-friendly delivery addresses
  • Gaming: Location-based game mechanics
  • International: Cross-language location sharing with ASCII compatibility
  • Navigation: Easy-to-communicate waypoints

🔬 Technical Details

  • Precision: ~0.5 meter accuracy (H3 Resolution 15)
  • Coverage: 122 × 7^15 = 579,202,504,213,046 H3 positions
  • Constraint: max_consecutive = 1 (no adjacent identical syllables)
  • Spatial optimization: 100% adjacency through Hamiltonian path
  • Geographic ordering: Syllables ordered coarse-to-fine (like postal codes)
  • Performance: ~6,700 conversions/second

Geographic Similarity

Nearby locations share syllable prefixes, making addresses intuitive:

# Coordinates ~75m apart in Paris
system.coordinate_to_syllable(48.8566, 2.3522)  # "bi-me-mu-mu|hi-vu-ka-ju"
system.coordinate_to_syllable(48.8567, 2.3523)  # "bi-me-mu-mu|hi-vu-ne-go"
                                                 #  ^^^^^^^^^^^^^^^ shared prefix (75%)

This works because syllables represent geographic hierarchy from coarse (continent/country) to fine (meter-level), similar to how postal codes work.

📖 API Reference

Core Functions

from hex_address import H3SyllableSystem

# Initialize with specific configuration
system = H3SyllableSystem('ascii-fqwfmd')

# Convert coordinates to syllable
address = system.coordinate_to_syllable(latitude, longitude)

# Convert syllable to coordinates
latitude, longitude = system.syllable_to_coordinate(address)

# Validate syllable address
is_valid = system.is_valid_syllable_address(address)

# Get system information
info = system.get_system_info()

# Test round-trip accuracy
result = system.test_round_trip(latitude, longitude)

Convenience Functions

from h3_syllable import coordinate_to_syllable, syllable_to_coordinate

# Quick conversions with default config
address = coordinate_to_syllable(48.8566, 2.3522)
lat, lon = syllable_to_coordinate(address)

# With specific config
address = coordinate_to_syllable(48.8566, 2.3522, config_name='ascii-cjbnb')

📖 Documentation

For complete documentation, architecture details, and live demo, visit the Hex Address App.

🤝 Contributing

Contributions welcome! See CONTRIBUTING.md for guidelines.

📄 License

MIT License - see LICENSE for details.

Project details


Download files

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

Source Distribution

hex_address-1.4.0.tar.gz (36.3 kB view details)

Uploaded Source

Built Distribution

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

hex_address-1.4.0-py3-none-any.whl (28.4 kB view details)

Uploaded Python 3

File details

Details for the file hex_address-1.4.0.tar.gz.

File metadata

  • Download URL: hex_address-1.4.0.tar.gz
  • Upload date:
  • Size: 36.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.3

File hashes

Hashes for hex_address-1.4.0.tar.gz
Algorithm Hash digest
SHA256 3156506238812608c58aa0009cc57ea54bd11ff5792265983505ffb85f2e6854
MD5 38b29b616a57e9a9e5849cb94271f6e0
BLAKE2b-256 24614cf57426a7621a171630ff22d4d2509827cf61b01f2221208319d5bdd5fb

See more details on using hashes here.

File details

Details for the file hex_address-1.4.0-py3-none-any.whl.

File metadata

  • Download URL: hex_address-1.4.0-py3-none-any.whl
  • Upload date:
  • Size: 28.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.3

File hashes

Hashes for hex_address-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2e230f0bee878b599303cb4469b19f6c600e27f3f5fc56287b7e043dadeb6478
MD5 19c892ab7dc232a29037b4dd3bbf0990
BLAKE2b-256 f9cbbea05aad20fefa4bddf1651c50e1fa9715c42cb105044a7c3c3767ff12c8

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