# Maidenhead <-> Lat/Lon
[![DOI](https://zenodo.org/badge/132653071.svg)](https://zenodo.org/badge/latestdoi/132653071)
[![ci](https://github.com/space-physics/maidenhead/actions/workflows/ci.yml/badge.svg)](https://github.com/space-physics/maidenhead/actions/workflows/ci.yml)
[![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/space-physics/maidenhead.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/space-physics/maidenhead/context:python)
[![pypi versions](https://img.shields.io/pypi/pyversions/maidenhead.svg)](https://pypi.python.org/pypi/maidenhead)
[![PyPi Download stats](http://pepy.tech/badge/maidenhead)](http://pepy.tech/project/maidenhead)
`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
## Install
```sh
pip install maidenhead
```
or for development version
```sh
git clone https://github.com/space-physics/maidenhead
pip install -e maidenhead
```
## Examples
All examples assume first doing
```python
import maidenhead as mh
```
### lat lon to Maidenhead locator
```python
mh.to_maiden(lat, lon, level)
```
returns a char (len = lvl*2)
### Maidenhead locator to lat lon
```python
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:
```sh
python -m maidenhead 65.0 -148.0
```
> BP65aa
```sh
python -m maidenhead BP65aa12
```
> 65.0083 -147.9917
The "python -m" CLI is also available:
```sh
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](https://github.com/google/open-location-code/tree/master/python).
Raw data
{
"_id": null,
"home_page": "https://github.com/space-physics/maidenhead",
"name": "maidenhead",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "location,maidenhead",
"author": "Michael Hirsch; Henri Kuiper",
"author_email": "scivision@users.noreply.github.com",
"download_url": "https://files.pythonhosted.org/packages/0e/44/3d1a97c37496c1c0de1d8b78dd74e3c9a1dfe29f598769ac51b1297d09ef/maidenhead-1.7.0.tar.gz",
"platform": null,
"description": "# Maidenhead <-> Lat/Lon\r\n\r\n[![DOI](https://zenodo.org/badge/132653071.svg)](https://zenodo.org/badge/latestdoi/132653071)\r\n[![ci](https://github.com/space-physics/maidenhead/actions/workflows/ci.yml/badge.svg)](https://github.com/space-physics/maidenhead/actions/workflows/ci.yml)\r\n[![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/space-physics/maidenhead.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/space-physics/maidenhead/context:python)\r\n[![pypi versions](https://img.shields.io/pypi/pyversions/maidenhead.svg)](https://pypi.python.org/pypi/maidenhead)\r\n[![PyPi Download stats](http://pepy.tech/badge/maidenhead)](http://pepy.tech/project/maidenhead)\r\n\r\n`maidenhead` provides a simple, yet effective location hashing algorithm.\r\nMaidenhead allows global location precision down to 750m\r\n\r\nMaidenhead provides 4 levels of increasing accuracy\r\n\r\n Level | Precision\r\n--------|------------\r\n 1 | World\r\n 2 | Regional\r\n 3 | Metropolis\r\n 4 | City\r\n\r\n## Install\r\n\r\n```sh\r\npip install maidenhead\r\n```\r\n\r\nor for development version\r\n\r\n```sh\r\ngit clone https://github.com/space-physics/maidenhead\r\n\r\npip install -e maidenhead\r\n```\r\n\r\n## Examples\r\n\r\nAll examples assume first doing\r\n\r\n```python\r\nimport maidenhead as mh\r\n```\r\n\r\n### lat lon to Maidenhead locator\r\n\r\n```python\r\nmh.to_maiden(lat, lon, level)\r\n```\r\n\r\nreturns a char (len = lvl*2)\r\n\r\n### Maidenhead locator to lat lon\r\n\r\n```python\r\nmh.to_location('AB01cd')\r\n```\r\n\r\ntakes Maidenhead location string and returns top-left lat, lon of Maidenhead grid square.\r\n\r\nThe `center=True` option outputs lat lon of the center of provided maidenhead grid square, instead of the default southwest corner.\r\n\r\n## Command Line\r\n\r\nThe command line interface takes either decimal degrees for \"latitude longitude\" or the Maidenhead locator string:\r\n\r\n```sh\r\npython -m maidenhead 65.0 -148.0\r\n```\r\n\r\n> BP65aa\r\n\r\n```sh\r\npython -m maidenhead BP65aa12\r\n```\r\n\r\n> 65.0083 -147.9917\r\n\r\nThe \"python -m\" CLI is also available:\r\n\r\n```sh\r\npython -m maidenhead 65.0 -148.0\r\n```\r\n\r\nThe `--center` option outputs lat lon of the center of provided maidenhead grid square, instead of the default southwest corner.\r\n\r\n## Alternatives\r\n\r\nOpen Location Codes a.k.a Plus Codes are in\r\n[Python code by Google](https://github.com/google/open-location-code/tree/master/python).\r\n",
"bugtrack_url": null,
"license": "",
"summary": "Maidenhead Locator, Lat Lon coordinate convertor",
"version": "1.7.0",
"project_urls": {
"Homepage": "https://github.com/space-physics/maidenhead"
},
"split_keywords": [
"location",
"maidenhead"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "0e443d1a97c37496c1c0de1d8b78dd74e3c9a1dfe29f598769ac51b1297d09ef",
"md5": "648fbcad89f4e38a1fe515412373d41a",
"sha256": "36415dce8f630927e59232c88d08135218d3281950b3d3eb5d7caa04a7623f74"
},
"downloads": -1,
"filename": "maidenhead-1.7.0.tar.gz",
"has_sig": false,
"md5_digest": "648fbcad89f4e38a1fe515412373d41a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 5792,
"upload_time": "2022-11-25T19:49:49",
"upload_time_iso_8601": "2022-11-25T19:49:49.569414Z",
"url": "https://files.pythonhosted.org/packages/0e/44/3d1a97c37496c1c0de1d8b78dd74e3c9a1dfe29f598769ac51b1297d09ef/maidenhead-1.7.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-11-25 19:49:49",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "space-physics",
"github_project": "maidenhead",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "maidenhead"
}