From b6e077c069d062220e91d5709426165005762535 Mon Sep 17 00:00:00 2001 From: Michael Haberler Date: Sat, 29 Oct 2022 14:18:44 +0200 Subject: [PATCH 1/3] do not fail if sourcetable entry lacks coordinates --- ntripbrowser/ntripbrowser.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ntripbrowser/ntripbrowser.py b/ntripbrowser/ntripbrowser.py index 36ed263..a5f902b 100644 --- a/ntripbrowser/ntripbrowser.py +++ b/ntripbrowser/ntripbrowser.py @@ -309,7 +309,10 @@ def _trim_outlying(self, ntrip_dictionary): def _trim_outlying_casters(self, ntrip_type_dictionary): def by_distance(row): - return row['Distance'] < self.maxdist + try: + return row['Distance'] < self.maxdist + except Exception: + return False inlying_casters = list(filter(by_distance, ntrip_type_dictionary)) inlying_casters.sort(key=lambda row: row['Distance']) return inlying_casters From 7d8ccd015d2c47597f25ba789301ec630e24344d Mon Sep 17 00:00:00 2001 From: Michael Haberler Date: Sat, 29 Oct 2022 14:18:58 +0200 Subject: [PATCH 2/3] document change --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e7db1ba..640ff9d 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ browser.get_mountpoints() > Form of coordiantes must be `(x, y)` or `(x.x, y.y)` of latitude, longitude. - `maxdist` -> Use `maxdist` to only report stations less than this number of km away from given coordinate. +> Use `maxdist` to only report stations less than this number of km away from given coordinate. Stations lacking coordinates will not be returned. #### Result From 4ef7dd2a1da62c02e4725f0c30b5fb95a1a4896e Mon Sep 17 00:00:00 2001 From: Michael Haberler Date: Sat, 29 Oct 2022 14:19:26 +0200 Subject: [PATCH 3/3] add example: query rtk2go.com --- example.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 example.py diff --git a/example.py b/example.py new file mode 100644 index 0000000..81005f1 --- /dev/null +++ b/example.py @@ -0,0 +1,11 @@ +from ntripbrowser import NtripBrowser +import json + +host = "rtk2go.com" +coordinates = (47.1291, 15.2119) +maxdist = 50 #km + +browser = NtripBrowser(host, port=2101, timeout=15, +coordinates=coordinates, maxdist=maxdist) +mp = browser.get_mountpoints() +print(json.dumps(mp, indent=4))