From 6104fd37bdc8cd5f136c4e0922941560255a37e9 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 8 Jun 2021 14:45:43 +0100 Subject: [PATCH] More nogo areas --- locations_nogo.txt | 2 ++ tests.py | 41 ++++++++++++++++++++++++++++++++++++++++- 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/locations_nogo.txt b/locations_nogo.txt index 5e8621452..8451ab922 100644 --- a/locations_nogo.txt +++ b/locations_nogo.txt @@ -1,2 +1,4 @@ NEW YORK, USA: 73.951W,40.879, 73.974W,40.83, 74.029W,40.756, 74.038W,40.713, 74.056W,40.713, 74.127W,40.647, 74.038W,40.629, 73.995W,40.667, 74.014W,40.676, 73.994W,40.702, 73.967W,40.699, 73.958W,40.729, 73.956W,40.745, 73.918W,40.781, 73.937W,40.793, 73.946W,40.782, 73.977W,40.738, 73.98W,40.713, 74.012W,40.705, 74.006W,40.752, 73.955W,40.824 NEW YORK, USA: 74.115W,40.663, 74.065W,40.602, 74.118W,40.555, 74.047W,40.516, 73.882W,40.547, 73.909W,40.618, 73.978W,40.579, 74.009W,40.602, 74.033W,40.61, 74.039W,40.623, 74.032W,40.641, 73.996W,40.665 +LONDON, ENGLAND: 0.23888E,51.459, 0.1216E,51.5, 0.016E,51.479, 0.097W,51.502, 0.126W,51.482, 0.196W,51.457, 0.292W,51.465, 0.309W,51.49, 0.226W,51.495, 0.198W,51.47, 0.174W,51.488, 0.136W,51.489, 0.1189W,51.515, 0.038E,51.513, 0.0692E,51.51, 0.12833E,51.526, 0.3289E,51.475 +LONDON, ENGLAND: 0.054W,51.535, 0.044W,51.53, 0.008W,51.55, 0.0429W,51.57, 0.038W,51.6, 0.0209W,51.603, 0.032W,51.613, 0.00191E,51.66, 0.024W,51.666, 0.0313W,51.659, 0.0639W,51.579, 0.059W,51.568, 0.0329W,51.552 diff --git a/tests.py b/tests.py index 72bc5f12f..d8d91c159 100644 --- a/tests.py +++ b/tests.py @@ -3626,7 +3626,8 @@ def testSpoofGeolocation() -> None: 'HOUSTON, USA:29.6072:W95.1586:1553', 'MANCHESTER, ENGLAND:53.4794892:W2.2451148:630', 'BERLIN, GERMANY:52.5170365:13.3888599:891', - 'ANKARA, TURKEY:39.93:32.85:24521' + 'ANKARA, TURKEY:39.93:32.85:24521', + 'LONDON, ENGLAND:51.5073219:W0.1276474:1738' ] testSquare = [ [[0.03, 0.01], [0.02, 10], [10.01, 10.02], [10.03, 0.02]] @@ -3698,6 +3699,44 @@ def testSpoofGeolocation() -> None: str(coords[0]) + ',0\n' kmlStr += ' \n' kmlStr += '\n' + + nogoLine = \ + 'LONDON, ENGLAND: 0.23888E,51.459, 0.1216E,51.5, ' + \ + '0.016E,51.479, 0.097W,51.502, 0.126W,51.482, ' + \ + '0.196W,51.457, 0.292W,51.465, 0.309W,51.49, ' + \ + '0.226W,51.495, 0.198W,51.47, 0.174W,51.488, ' + \ + '0.136W,51.489, 0.1189W,51.515, 0.038E,51.513, ' + \ + '0.0692E,51.51, 0.12833E,51.526, 0.3289E,51.475' + polygon = parseNogoString(nogoLine) + nogoLine2 = \ + 'LONDON, ENGLAND: 0.054W,51.535, 0.044W,51.53, ' + \ + '0.008W,51.55, 0.0429W,51.57, 0.038W,51.6, ' + \ + '0.0209W,51.603, 0.032W,51.613, 0.00191E,51.66, ' + \ + '0.024W,51.666, 0.0313W,51.659, 0.0639W,51.579, ' + \ + '0.059W,51.568, 0.0329W,51.552' + polygon2 = parseNogoString(nogoLine2) + nogoList = [polygon, polygon2] + for i in range(1000): + dayNumber = randint(10, 30) + hour = randint(1, 23) + hourStr = str(hour) + if hour < 10: + hourStr = '0' + hourStr + currTime = datetime.datetime.strptime("2021-05-" + str(dayNumber) + + " " + hourStr + ":14", + "%Y-%m-%d %H:%M") + coords = spoofGeolocation('', 'london, england', currTime, + decoySeed, citiesList, nogoList) + longitude = coords[1] + if coords[3] == 'W': + longitude = -coords[1] + kmlStr += '\n' + kmlStr += ' ' + str(i) + '\n' + kmlStr += ' \n' + kmlStr += ' ' + str(longitude) + ',' + \ + str(coords[0]) + ',0\n' + kmlStr += ' \n' + kmlStr += '\n' kmlStr += '\n' kmlStr += '' kmlFile = open('unittest_decoy.kml', 'w+')