Skip to content

Python Maidenhead <--> WGS84 coordinate conversions

License

Notifications You must be signed in to change notification settings

cedricdelayre/maidenhead

 
 

Repository files navigation

Maidenhead <-> Lat/Lon

DOI ci pypi versions PyPi Download stats

maidenhead provides a simple, yet effective location hashing algorithm. Maidenhead allows global location precision down to 750m

Maidenhead provides 4 levels of increasing accuracy

Level Precision
1 World
2 Regional
3 Metropolis
4 City
pip install maidenhead

or for development version

git clone https://github.com/space-physics/maidenhead

pip install -e maidenhead

Examples assume first doing

import maidenhead as mh

Lat, lon to Maidenhead locator:

mh.to_maiden(lat, lon, level)

returns a char (len = lvl*2)

Maidenhead locator to lat lon:

mh.to_location('AB01cd')

takes Maidenhead location string and returns top-left lat, lon of Maidenhead grid square.

The center=True option outputs lat lon of the center of provided maidenhead grid square, instead of the default southwest corner.

Command Line

The command line interface takes either decimal degrees for "latitude longitude" or the Maidenhead locator string:

python -m maidenhead 65.0 -148.0

BP65aa

python -m maidenhead BP65aa12

65.0083 -147.9917

The "python -m" CLI is also available:

python -m maidenhead 65.0 -148.0

The --center option outputs lat lon of the center of provided maidenhead grid square, instead of the default southwest corner.

Alternatives

Open Location Codes a.k.a Plus Codes are in Python code by Google.

About

Python Maidenhead <--> WGS84 coordinate conversions

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 57.3%
  • Fortran 38.1%
  • CMake 4.6%