diff --git a/layers/chains/index.js b/layers/chains/index.js
index cc44439..d27025c 100644
--- a/layers/chains/index.js
+++ b/layers/chains/index.js
@@ -4,6 +4,7 @@ import kwikTripLayer from './kwik-trip/layer.js';
import menardsLayer from './menards/layer.js';
import milwaukeeBurgerCompanyLayer from './milwaukee-burger-company/layer.js';
import waffleHouseLayer from './waffle-house/layer.js';
+import whataburgerLayer from './whataburger/layer.js';
const chains = {
name: "Chains",
@@ -32,6 +33,10 @@ const chains = {
name: "Waffle House",
layer: waffleHouseLayer,
},
+ {
+ name: "Whataburger",
+ layer: whataburgerLayer,
+ },
],
};
diff --git a/layers/chains/whataburger/get_data.py b/layers/chains/whataburger/get_data.py
new file mode 100755
index 0000000..2bfb156
--- /dev/null
+++ b/layers/chains/whataburger/get_data.py
@@ -0,0 +1,46 @@
+#!/usr/bin/env python3
+
+import requests
+import json
+from bs4 import BeautifulSoup
+import re
+
+response = requests.get('https://locations.whataburger.com/directory.html')
+
+soup = BeautifulSoup(response.text, 'html.parser')
+state_links = soup.select('a.Directory-listLink')
+
+locations = []
+for state_link in state_links:
+ print(f"Fetching state data for {state_link.find('span').text}")
+ response = requests.get(f"https://locations.whataburger.com/{state_link['href']}")
+
+ # this _could_ break if there's a closing script tag in the script somehow, but I'm not too concerned
+ raw_state_data = re.search(r'', response.text)[1]
+ state_locations = json.loads(raw_state_data)['response']['entities']
+
+ for location in state_locations:
+ locations.append({
+ "type": "Feature",
+ "geometry": {
+ "type": "Point",
+ "coordinates": [location['profile']['yextDisplayCoordinate']['long'], location['profile']['yextDisplayCoordinate']['lat']], # yes, [lon, lat] since it's [x, y]
+ },
+ "properties": {
+ 'address': location['profile']['meta']['id'], # kinda?
+ # 'city': location_li.find('dd', class_="city-state-zip").text.split(',')[0],
+ # 'state': location_li.find('dd', class_="city-state-zip").text.split(', ')[1].split(' ')[0],
+ # 'zip': location_li.find('dd', class_="city-state-zip").text.split(' ')[-1],
+ 'website': "https://locations.whataburger.com/" + location['url'],
+ },
+ })
+
+geojson = {
+ "type": "FeatureCollection",
+ "features": locations,
+}
+
+print(len(locations), "locations found")
+
+with open("data.geojson", "w") as f:
+ f.write(json.dumps(geojson))
diff --git a/layers/chains/whataburger/layer.js b/layers/chains/whataburger/layer.js
new file mode 100644
index 0000000..af140b4
--- /dev/null
+++ b/layers/chains/whataburger/layer.js
@@ -0,0 +1,24 @@
+import VectorLayer from 'ol/layer/Vector';
+import {Vector as VectorSource} from 'ol/source.js';
+import GeoJSON from 'ol/format/GeoJSON.js';
+
+import {Style} from 'ol/style.js';
+import Icon from 'ol/style/Icon.js';
+
+import url from './data.geojson?url'; // TODO: remove `?url`?
+import pin from './pin.svg?url'; // TODO: remove `?url`?
+
+const vectorLayer = new VectorLayer({
+ source: new VectorSource({
+ url: url,
+ format: new GeoJSON,
+ }),
+ style: new Style({
+ image: new Icon({
+ anchor: [0.5, 1],
+ src: pin,
+ }),
+ }),
+});
+
+export default vectorLayer;
diff --git a/layers/chains/whataburger/pin.svg b/layers/chains/whataburger/pin.svg
new file mode 100644
index 0000000..ad2a79a
--- /dev/null
+++ b/layers/chains/whataburger/pin.svg
@@ -0,0 +1,16 @@
+
+