Add Raising Cane's layer
This commit is contained in:
parent
194e8e949c
commit
7917d1a1e7
4 changed files with 353 additions and 0 deletions
46
layers/chains/raising-canes/get_data.py
Executable file
46
layers/chains/raising-canes/get_data.py
Executable file
|
|
@ -0,0 +1,46 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import requests
|
||||
import json
|
||||
|
||||
print("Searching for Raising Cane's locations")
|
||||
response = requests.get('https://raisingcanes.com/page-data/sq/d/3976656178.json').json()
|
||||
|
||||
stores = []
|
||||
|
||||
for s in response['data']['allPrismicStoreLocation']['nodes']:
|
||||
if s['uid'] == 'ara2': # Not sure what's up with this one: https://raisingcanes.com/locations/ara2/
|
||||
continue
|
||||
elif s['uid'] == 'c524': # Null island? https://raisingcanes.com/locations/c524/
|
||||
s['data']['coordinates'] = {
|
||||
"longitude": -111.9811399,
|
||||
"latitude": 40.5447361,
|
||||
}
|
||||
stores.append({
|
||||
"type": "Feature",
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [float(s['data']['coordinates']['longitude']), float(s['data']['coordinates']['latitude'])], # yes, [lon, lat] since it's [x, y]
|
||||
},
|
||||
"properties": {
|
||||
'name': s['data']['external_location_data']['displayName'],
|
||||
'nickname': s['data']['external_location_data']['nickname'],
|
||||
'address': s['data']['external_location_data']['address1'],
|
||||
'city': s['data']['external_location_data']['city'],
|
||||
'state': s['data']['external_location_data']['state'],
|
||||
'zip': s['data']['external_location_data']['postal_code'],
|
||||
'website': f"https://raisingcanes.com/locations/{s['uid']}",
|
||||
'opened': s['data']['external_location_data']['birthdate'],
|
||||
'hours': s['data']['external_location_data']['hours'],
|
||||
},
|
||||
})
|
||||
|
||||
print(f"""{len(stores)} locations found""")
|
||||
|
||||
geojson = {
|
||||
"type": "FeatureCollection",
|
||||
"features": stores,
|
||||
}
|
||||
|
||||
with open("data.geojson", "w") as f:
|
||||
f.write(json.dumps(geojson))
|
||||
Loading…
Add table
Add a link
Reference in a new issue