Add Waffle House layer

This commit is contained in:
Chandler Swift 2023-07-24 22:44:54 -05:00
parent eb1a8fd17c
commit ca24e3b6ea
Signed by: chandlerswift
GPG key ID: A851D929D52FB93F
4 changed files with 132 additions and 1 deletions

View file

@ -7,6 +7,7 @@ import arenasLayer from './nhl-arenas/layer.js';
import menardsLayer from './menards/layer.js'; import menardsLayer from './menards/layer.js';
import culversLayer from './culvers/layer.js'; import culversLayer from './culvers/layer.js';
import kwikTripLayer from './kwik-trip/layer.js'; import kwikTripLayer from './kwik-trip/layer.js';
import waffleHouseLayer from './waffle-house/layer.js';
const layerCategories = [ const layerCategories = [
{ {
@ -70,7 +71,11 @@ const layerCategories = [
{ {
name: "Kwik Trip/Kwik Star", name: "Kwik Trip/Kwik Star",
layer: kwikTripLayer, layer: kwikTripLayer,
} },
{
name: "Waffle House",
layer: waffleHouseLayer,
},
] ]
} }
]; ];

41
layers/waffle-house/get_data.py Executable file
View file

@ -0,0 +1,41 @@
#!/usr/bin/env python3
import requests
import re
import json
res = requests.get('https://locations.wafflehouse.com/')
content = res.text
locations = re.search(r'<script id="__NEXT_DATA__" type="application/json">(.*)</script>', content)[1]
locations = json.loads(locations)['props']['pageProps']['locations']
stores = []
for location in locations:
stores.append({
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [float(location['longitude']), float(location['latitude'])], # yes, [lon, lat] since it's [x, y]
},
"properties": {
'address': location['addressLines'][0].title(),
'city': location['city'].title(),
'state': location['state'],
'zip': location['postalCode'],
'website': location['websiteURL'],
},
})
geojson = {
"type": "FeatureCollection",
"features": stores,
}
with open("waffle-house-data.geojson", "w") as f:
f.write(json.dumps(geojson))
print(f"{len(locations)} locations found")

View file

@ -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 waffleHouseURL from '/data/waffle-house-data.geojson?url'; // TODO: remove `?url`?
import pinURL from '/layers/waffle-house/pin.svg?url'; // TODO: remove `?url`?
const vectorLayer = new VectorLayer({
source: new VectorSource({
url: waffleHouseURL,
format: new GeoJSON,
}),
style: new Style({
image: new Icon({
anchor: [0.5, 1],
src: pinURL,
}),
}),
});
export default vectorLayer;

View file

@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
viewBox="0 0 384 512"
width="40px"
height="30px"
version="1.1"
id="svg873"
sodipodi:docname="menards-location-pin-solid.svg"
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04, custom)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs877">
<mask
maskUnits="userSpaceOnUse"
id="mask5454">
<path
d="m 384,192 c 0,87.4 -117,243 -168.3,307.2 -12.3,15.3 -35.1,15.3 -47.4,0 C 116.1,435 -1.4e-6,279.4 -1.4e-6,192 -1.4e-6,85.96 85.959999,0 192,0 245.96029,0 294.73775,22.2758 329.62577,58.13661 363.27205,92.72104 384,139.94065 384,192 Z"
id="path5456"
sodipodi:nodetypes="sccssss"
style="fill:#ffffff;fill-opacity:1" />
</mask>
</defs>
<sodipodi:namedview
id="namedview875"
pagecolor="#505050"
bordercolor="#eeeeee"
borderopacity="1"
inkscape:pageshadow="0"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="0"
showgrid="false"
inkscape:zoom="1.1255704"
inkscape:cx="130.15623"
inkscape:cy="299.84798"
inkscape:window-width="1916"
inkscape:window-height="1030"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg873" />
<!--! Font Awesome Pro 6.0.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. -->
<path
d="m 384,192 c 0,87.4 -117,243 -168.3,307.2 -12.3,15.3 -35.1,15.3 -47.4,0 C 116.1,435 0,279.4 0,192 0,85.96 85.96,0 192,0 245.96029,0 294.73775,22.275796 329.62577,58.136607 363.27205,92.721042 384,139.94065 384,192 Z"
id="path871"
sodipodi:nodetypes="sccssss"
style="fill:#fff200;fill-opacity:1" />
<image
width="310.314"
height="310.31412"
preserveAspectRatio="none"
xlink:href="data:image/webp;base64,UklGRiIFAABXRUJQVlA4TBUFAAAvH8AHECI51rad1vPEqGzbtm3btm3bxm/btm3bsW1z/4j6XaXOIDyOvVb6DOFUWakyhNNlZQBpnZwBpM4M3insAeT0mYAsSJJN26prfdm2bdv2vc+2bdu2bduHz7Zt2wOpkSRJctoj76qs3n0vgZUiCgABVj6AbXt9bc1bsr24E2yRzWayEZn/Cda+bftNAPtYBeQAeoDGga8BWwAaAdQBwlIKkAU0WyPaH4/rlOYMbvNHHPOHjxn9y4AmKZ+jPwAaAgSnBCAIaKZ3Q9g441Bb/1ge+jhqHjv1stdcDqrHZPdHZvlaPq5UDreXgI7kAbKLeNhjgz1Fcf3S2TosD6fgu+7sP9wQXBUc/S7u553x3qK64VDffG2enYC2k/O2pK/9jXx2uJ1fMQ/TLcG9FwWnBURXBDsXDaODS3FDAVwlDRBays8+hT8+etR/ZgxsGhud4dGW8KZsmV82zg3rZ7X4V+mSiMzqNGNwiXyayGR/0ti5JJYXoM0kAXYNDjSTY4fBgQIATMCtdPmHKxeUuI7l5eI3Q9WiW8WIcuaDOycgwwPJQvFMG+AAZUkAFPRr7nR2P2H3zMk/RljIzdwSc0vQu7EDorE9UdBtM6DVdUvkk0hEsuuG6taVy07PkwB0LrniMjo0bgkMDgRhuSBHPlcSCAILRaBWRcvniqNTgjMC/pJg/wex1a55IxKgJhFATIt8Y6m4nM47UtoYuD6N3cmvblS3HxVCAnfkh5NZk34QXRdcEBBR0D23a+kFdAZIZQK0zx2ebDTXoa9CG+cmbkzXsn7u43et1UmUtPrYtfToUPnL6kjT3FG2LRoBd8qe90lly6GxvaiuLpP6PPr7V4NUew8YYAJMLpvQrFSDaN6IwIHhdbmJMxg7QfeGtfdxymlThG2Lj8Mvw4WvbvrASwiK1o7L5fw1qnP4yARsffXUy1LRSDyhp+P6Ni907GcQAhdx34izWhjBke+BaOWUwM0ZnshCMUZ3MYA5JmBr91QKN5lM0y1x5HvT/VXblsjkWOJqJwSiJ4XcgsDtargheDemqwHMMgGNL53Q3tE1QdOsw+KEI5JcHrpUH0TjeySA/s2b75nkfSaZHm+CzGbuSfgzMT++hncIQGNMgJY5w5Kt5jrwWc4KTv0NJHqz54O5LOb1s/zOgRvZ+VgxZq0csxpnDq5fs0AmR4LGjlUrXm8BvUyAyKbZxkLxOJ519P8pL7oiuCog/7tOkFbfPSPqUh042bWBbLVFYvkBdAxIYmKBjiSWDcODg0Q8z/MiklgWuHYlSXxTcPyH+8Kd/IEzP2ClXLOHJkA5myggu2eD0dnzWKkCfeB50SdxvZTC6exJRJq7Apff+Try/o/M2qG588hupUdsEgFb2rvbrmVr9zNDH/g/xz64nUtGWgOT0RhzhrWTn4LvxVQ7IWQwQeP00ijrn+uFZ/oAAyhNCiCwsLveuJw7Ni+8Iu844t8c+GIczsqe9zjwBd7XcfCbCXhgIp6Adi0JypuLzKoEtMAm+X1xb/vufH7Irlk6WwvRZ2K8LKKyYbieX0obC9Alm0xAcm57u9fe1hTWLt1tw3R/8r3mjn2Xf+cFe98ZB20w2l3UNh5qm65VkxLQKpt8wESncrdh2lBa85gffOxVj6262aqHvfJjsOMjsWgtHlVK+thDQD2bku+BJsoF+v3Q1mlG/zZrcJg1KE3pXXpUx58s5nYH6GdTGlACGAQ2CpgGTAENAxoBcexjFQA=
"
id="image2008"
x="34.402168"
y="26.948332"
mask="url(#mask5454)" />
</svg>

After

Width:  |  Height:  |  Size: 3.9 KiB