From ecb23ad73b9f15279b3b99455bfbd87854b7b713 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20DELAYRE?= Date: Thu, 14 Sep 2023 16:58:08 +0200 Subject: [PATCH] add precision up to 6 pairs in maidenhead --- README.md | 4 ++++ src/maidenhead/__main__.py | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 211c92f..297efbd 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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). diff --git a/src/maidenhead/__main__.py b/src/maidenhead/__main__.py index 3c6a1ed..b69f3fd 100644 --- a/src/maidenhead/__main__.py +++ b/src/maidenhead/__main__.py @@ -7,7 +7,7 @@ def main( loc: str | tuple[float, float], - precision: int = 3, + precision: int = 6, url: bool = False, center: bool = False, ) -> str | tuple[float, float]: @@ -15,7 +15,7 @@ def main( 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]))