Skip to content

Instantly share code, notes, and snippets.

@ovo
Created February 22, 2024 01:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ovo/f82126e1321c83d0a2b18950aaecb2ce to your computer and use it in GitHub Desktop.
Save ovo/f82126e1321c83d0a2b18950aaecb2ce to your computer and use it in GitHub Desktop.
python script to export stores to a csv that can be used as GIS data
import requests
import pandas as pd
# Coordinates for Ames, Iowa
LAT = "42.030781"
LONG = "-93.631913"
def convert_data(lat, long):
# Store finder API URL
url = f"https://us.zyn.com/find-a-store/GetStores/?lat={lat}&lng={long}"
r = requests.get(url)
data = r.json()
df = pd.DataFrame(data["Data"])
df.to_csv("zyn_data.csv", index=False)
if __name__ == "__main__":
convert_data(LAT, LONG)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment