Add Milwaukee Burger Company layer

main
Chandler Swift 2023-07-25 17:41:31 -05:00
parent 066315f36a
commit e203a93478
Signed by: chandlerswift
GPG Key ID: A851D929D52FB93F
4 changed files with 88 additions and 0 deletions

View File

@ -10,6 +10,7 @@ import culversLayer from './culvers/layer.js';
import kwikTripLayer from './kwik-trip/layer.js';
import waffleHouseLayer from './waffle-house/layer.js';
import krispyKremeLayer from './krispy-kreme/layer.js';
import milwaukeeBurgerCompanyLayer from './milwaukee-burger-company/layer.js';
const layerCategories = [
{
@ -87,6 +88,10 @@ const layerCategories = [
name: "Krispy Kreme",
layer: krispyKremeLayer,
},
{
name: "Milwaukee Burger Company",
layer: milwaukeeBurgerCompanyLayer,
},
]
}
];

View File

@ -0,0 +1,43 @@
#!/usr/bin/env python3
import requests
import json
from bs4 import BeautifulSoup
print("Searching for Milwaukee Burger Company locations")
# 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://milwaukeeburgercompany.com/', headers=UA)
soup = BeautifulSoup(response.text, 'html.parser')
location_lis = soup.select('section#locations ul.location-list > li')
locations = []
for location_li in location_lis:
lon = location_li
locations.append({
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [float(location_li['data-lng']), float(location_li['data-lat'])], # yes, [lon, lat] since it's [x, y]
},
"properties": {
'address': location_li.find('dd', class_="street").text,
'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],
},
})
geojson = {
"type": "FeatureCollection",
"features": locations,
}
with open("milwaukee-burger-company-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/milwaukee-burger-company-data.geojson?url'; // TODO: remove `?url`?
import pin from '/layers/milwaukee-burger-company/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;

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
viewBox="0 0 384 512"
width="40px"
height="30px"
version="1.1"
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">
<!--! 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"
style="fill:#000;fill-opacity:1" />
</svg>

After

Width:  |  Height:  |  Size: 848 B