Add Punch Pizza

This commit is contained in:
Chandler Swift 2023-08-19 13:52:20 -05:00
parent 78f9830400
commit 645aa85751
Signed by: chandlerswift
GPG key ID: A851D929D52FB93F
4 changed files with 132 additions and 0 deletions

View file

@ -4,6 +4,7 @@ import krispyKremeLayer from './krispy-kreme/layer.js';
import kwikTripLayer from './kwik-trip/layer.js'; import kwikTripLayer from './kwik-trip/layer.js';
import menardsLayer from './menards/layer.js'; import menardsLayer from './menards/layer.js';
import milwaukeeBurgerCompanyLayer from './milwaukee-burger-company/layer.js'; import milwaukeeBurgerCompanyLayer from './milwaukee-burger-company/layer.js';
import punchPizzaLayer from './punch-pizza/layer.js';
import waffleHouseLayer from './waffle-house/layer.js'; import waffleHouseLayer from './waffle-house/layer.js';
import whataburgerLayer from './whataburger/layer.js'; import whataburgerLayer from './whataburger/layer.js';
@ -34,6 +35,10 @@ const chains = {
name: "Milwaukee Burger Company", name: "Milwaukee Burger Company",
layer: milwaukeeBurgerCompanyLayer, layer: milwaukeeBurgerCompanyLayer,
}, },
{
name: "Punch Pizza",
layer: punchPizzaLayer,
},
{ {
name: "Waffle House", name: "Waffle House",
layer: waffleHouseLayer, layer: waffleHouseLayer,

View file

@ -0,0 +1,43 @@
#!/usr/bin/env python3
import requests
import json
from bs4 import BeautifulSoup
import re
import urllib.parse
# Stolen from my machine, appears to work; sufficient and necessary to get
# around their firewall apparently?
UA={
"User-Agent": 'Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/114.0'
}
response = requests.get('https://punchpizza.com/locations/', headers=UA)
soup = BeautifulSoup(response.text, 'html.parser')
location_links = soup.select('div.loctop > .wpb_wrapper > ul > li > a') # Two rows with the same id :eyeroll:
locations = []
for location_link in location_links:
location_response = response = requests.get(urllib.parse.urljoin("https://punchpizza.com", location_link['href']), headers=UA)
latlon = re.search(r'var punchloc = {lat: ([0-9.-]*), lng: ([0-9.-]*)};', location_response.text)
if not latlon:
raise Exception("No latlon found")
locations.append({
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [float(latlon[2]), float(latlon[1])], # yes, [lon, lat] since it's [x, y]
},
# TODO: addresses are kind of a mess
})
geojson = {
"type": "FeatureCollection",
"features": locations,
}
print(len(locations), "locations found")
with open("data.geojson", "w") as f:
f.write(json.dumps(geojson))

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 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, // or https://punchpizza.com/wp-content/themes/sprung-total/img/mappoint-punch.png
}),
}),
});
export default vectorLayer;

View file

@ -0,0 +1,60 @@
<?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:#ea551d;fill-opacity:1" />
<image
width="310.314"
height="310.31412"
preserveAspectRatio="none"
xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAAZlBMVEUAAADwVSLwVSLwVSLwVSLwVSLwVSLwVSLwVSLwVSLwVSLwVSLwVSLwVSLwVSLwVSL/wg7xWSHyYR/1dxv3hBn9tRD+vQ/6mxX9rxH0bR32fBr4iRj5kRb7ohT0cR3+uQ/zah78qBNSmiP3AAAAD3RSTlMAw596NAj08+Df2lYyGhgcs1RcAAABF0lEQVQ4y3WTiY6EIBBE1WEO5+oSEBXP+f+f3F5xFlnkJR5JP61KgCxE5LnI0rwKYopXYnw+XWjlcjofzR83+uP2iMYiJ0flHrmIwx0NMb6KD/9SS76FVQSHe1q9q+Jy7hQII3nuqxDMJRpX1BEKXccdwRFDQugVVQBbbUL4bIJEQjA9X7BkIY+F1kiqoeVcJ/6g0ZCB1ugTgkQrgWnEkhAqmAWQBvJImH4FKEAD/NpHQsMGMAA1uGMfC2pW9MFK0w1miTvMGK0TtMF8UFLVaJ1QA40X/HJXPN8MVe2XW5SbYbFhyVGK75a7ul+Mg+omO4zu++tu978Liije2Z5nHo7zZ3xwSj8u44Pjq/jwGK7iwz1hlf/hP2H8KucDDFvkAAAAAElFTkSuQmCC"
id="image2008"
x="34.402168"
y="26.948332"
mask="url(#mask5454)" />
</svg>

After

Width:  |  Height:  |  Size: 2.8 KiB