Skip to content

Instantly share code, notes, and snippets.

@joeywhelan
Created March 2, 2025 20:27
Show Gist options
  • Select an option

  • Save joeywhelan/f831239ee9a881c48f21a09562357da0 to your computer and use it in GitHub Desktop.

Select an option

Save joeywhelan/f831239ee9a881c48f21a09562357da0 to your computer and use it in GitHub Desktop.
def worker(ndocs):
global fake
result = []
for _ in range(ndocs):
uuid = str(uuid4())
coords = fake.local_latlng(country_code="US", coords_only=True)
lat = round(float(coords[0]) + random.uniform(-1, 1), 5) # faker local_latlng generates duplicates. this is a workaround
lng = round(float(coords[1]) + random.uniform(-1, 1), 5)
point_lnglat = f'{lng} {lat}'
point_wkt = Point(lng, lat).wkt
dob = fake.date_of_birth(minimum_age=10, maximum_age=90).year
result.append({"uuid": uuid, "point_lnglat": point_lnglat, "point_wkt": point_wkt, "dob": dob})
return result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment