Skip to content

Commit

Permalink
add precision up to 6 pairs in maidenhead
Browse files Browse the repository at this point in the history
  • Loading branch information
cedricdelayre authored and ErofeevK committed Aug 21, 2024
1 parent ce0b3cf commit ecb23ad
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ Maidenhead provides 4 levels of increasing accuracy
2 | Regional
3 | Metropolis
4 | City
5 | Street
6 | 1m precision

```sh
pip install maidenhead
Expand Down Expand Up @@ -81,3 +83,5 @@ The `--center` option outputs lat lon of the center of provided maidenhead grid

Open Location Codes a.k.a Plus Codes are in
[Python code by Google](https://github.com/google/open-location-code/tree/master/python).

Web convertor [Earth Point - Tools for Google Earth](https://www.earthpoint.us/Convert.aspx).
4 changes: 2 additions & 2 deletions src/maidenhead/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@

def main(
loc: str | tuple[float, float],
precision: int = 3,
precision: int = 6,
url: bool = False,
center: bool = False,
) -> str | tuple[float, float]:

if isinstance(loc, str): # maidenhead
maiden = copy(loc)
loc = maidenhead.to_location(loc, center)
print(f"{loc[0]:.4f} {loc[1]:.4f}")
print(f"{loc[0]:.7f} {loc[1]:.7f}")
elif len(loc) == 2: # lat lon
if isinstance(loc[0], str):
loc = (float(loc[0]), float(loc[1]))
Expand Down

0 comments on commit ecb23ad

Please sign in to comment.