41 lines
1.2 KiB
Python
Executable File
41 lines
1.2 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
from random import random
|
|
with open("./00-sample-latlon.csv", "w") as f:
|
|
f.write("lat,lon\n")
|
|
seen_coords = set()
|
|
|
|
# Normalized
|
|
for i in range(10000):
|
|
lat = (random() - .5) * 2 * 90
|
|
lon = (random() - .5) * 2 * 180
|
|
s = f"{lat},{lon}\n"
|
|
if s not in seen_coords:
|
|
seen_coords.add(s)
|
|
f.write(s)
|
|
|
|
# Edge cases
|
|
# Do both positive and negative
|
|
for neg in (1, -1):
|
|
# Add a little bit of variation
|
|
for dec in (0, .1, .5, .05, .9999):
|
|
# Possibly strange latitudes
|
|
for lat_i in (0, 1, 90):
|
|
# Possibly strong longitudes
|
|
for lon_i in (0, 1, 90, 180):
|
|
lat = neg * (lat_i - dec)
|
|
lon = neg * (lon_i - dec)
|
|
|
|
s = f"{lat:f},{lon:f}\n"
|
|
if s not in seen_coords:
|
|
seen_coords.add(s)
|
|
f.write(s)
|
|
|
|
# Non-normalized
|
|
for i in range(10000):
|
|
lat = (random() - .5) * 2 * 1000
|
|
lon = (random() - .5) * 2 * 1000
|
|
s = f"{lat},{lon}\n"
|
|
if s not in seen_coords:
|
|
seen_coords.add(s)
|
|
f.write(s)
|