main
Bob Mottram 2021-05-10 11:58:02 +01:00
parent a4f5662b8e
commit e2e2a55480
1 changed files with 6 additions and 0 deletions

View File

@ -161,13 +161,19 @@ def spoofGeolocation(baseDir: str,
fraction = randint(0, 100000) / 100000
latitude += \
distanceFromCityCenter * cityRadius * math.cos(angleRadians)
# add a small amount of variance around the location
latitude += (fraction * fraction * variance) - (variance / 2.0)
# gps locations aren't transcendental, so round to a fixed
# number of decimal places
latitude = int(latitude * 10000) / 10000.0
fraction = randint(0, 100000) / 100000
longitude += \
distanceFromCityCenter * cityRadius * math.sin(angleRadians)
# add a small amount of variance around the location
longitude += (fraction * fraction * variance) - (variance / 2.0)
# gps locations aren't transcendental, so round to a fixed
# number of decimal places
longitude = int(longitude * 10000) / 10000.0
return latitude, longitude, latdirection, longdirection