Compare commits
5 commits
da86da8877
...
645aa85751
Author | SHA1 | Date | |
---|---|---|---|
Chandler Swift | 645aa85751 | ||
Chandler Swift | 78f9830400 | ||
Chandler Swift | eed4688c3b | ||
Chandler Swift | 354d952567 | ||
Chandler Swift | bfef3a2c71 |
50
layers/chains/country-kitchen/get_data.py
Executable file
50
layers/chains/country-kitchen/get_data.py
Executable file
|
@ -0,0 +1,50 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import requests
|
||||||
|
import json
|
||||||
|
import re
|
||||||
|
|
||||||
|
# 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://countrykitchenrestaurants.com/locations/', headers=UA)
|
||||||
|
|
||||||
|
data = re.search(r'jQuery\(document\).ready\(function\(\$\) \{var map1 = \$\("#map1"\).maps\((.*)\).data\("wpgmp_maps"\);\}\);', response.text)
|
||||||
|
data = json.loads(data[1])
|
||||||
|
|
||||||
|
locations = []
|
||||||
|
for location in data['places']:
|
||||||
|
if "coming soon" in location['title'].lower():
|
||||||
|
continue
|
||||||
|
if location['title'] == "Dodgeville, WI":
|
||||||
|
# currently location['location']['country'] == 'WI', and no location['location']['state'] -- D'oh!
|
||||||
|
location['location']['state'] = 'WI'
|
||||||
|
try:
|
||||||
|
locations.append({
|
||||||
|
"type": "Feature",
|
||||||
|
"geometry": {
|
||||||
|
"type": "Point",
|
||||||
|
"coordinates": [float(location['location']['lng']), float(location['location']['lat'])], # yes, [lon, lat] since it's [x, y]
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
'address': location['address'],
|
||||||
|
'city': location['location']['city'],
|
||||||
|
'state': location['location']['state'],
|
||||||
|
'zip': location['location']['postal_code'],
|
||||||
|
},
|
||||||
|
})
|
||||||
|
except:
|
||||||
|
print(location)
|
||||||
|
|
||||||
|
geojson = {
|
||||||
|
"type": "FeatureCollection",
|
||||||
|
"features": locations,
|
||||||
|
}
|
||||||
|
|
||||||
|
print(len(locations), "locations found")
|
||||||
|
|
||||||
|
with open("data.geojson", "w") as f:
|
||||||
|
f.write(json.dumps(geojson))
|
24
layers/chains/country-kitchen/layer.js
Normal file
24
layers/chains/country-kitchen/layer.js
Normal 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,
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
export default vectorLayer;
|
59
layers/chains/country-kitchen/pin.svg
Normal file
59
layers/chains/country-kitchen/pin.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 15 KiB |
|
@ -1,14 +1,20 @@
|
||||||
|
import countryKitchenLayer from './country-kitchen/layer.js';
|
||||||
import culversLayer from './culvers/layer.js';
|
import culversLayer from './culvers/layer.js';
|
||||||
import krispyKremeLayer from './krispy-kreme/layer.js';
|
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';
|
||||||
|
|
||||||
const chains = {
|
const chains = {
|
||||||
name: "Chains",
|
name: "Chains",
|
||||||
layers: [
|
layers: [
|
||||||
|
{
|
||||||
|
name: "Country Kitchen",
|
||||||
|
layer: countryKitchenLayer,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "Culver's",
|
name: "Culver's",
|
||||||
layer: culversLayer,
|
layer: culversLayer,
|
||||||
|
@ -29,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,
|
||||||
|
|
43
layers/chains/punch-pizza/get_data.py
Executable file
43
layers/chains/punch-pizza/get_data.py
Executable 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))
|
24
layers/chains/punch-pizza/layer.js
Normal file
24
layers/chains/punch-pizza/layer.js
Normal 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;
|
60
layers/chains/punch-pizza/pin.svg
Normal file
60
layers/chains/punch-pizza/pin.svg
Normal 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 |
|
@ -9,6 +9,7 @@ import bikepackingLayer from './bikepacking/layer.js';
|
||||||
import chains from './chains/index.js';
|
import chains from './chains/index.js';
|
||||||
import census_bureau from './census-bureau/index.js';
|
import census_bureau from './census-bureau/index.js';
|
||||||
import states from './states/index.js';
|
import states from './states/index.js';
|
||||||
|
import national_land from './national-land/index.js';
|
||||||
|
|
||||||
const layerCategories = [
|
const layerCategories = [
|
||||||
{ // Base maps
|
{ // Base maps
|
||||||
|
@ -75,6 +76,7 @@ const layerCategories = [
|
||||||
chains,
|
chains,
|
||||||
census_bureau,
|
census_bureau,
|
||||||
states,
|
states,
|
||||||
|
national_land,
|
||||||
];
|
];
|
||||||
|
|
||||||
export default layerCategories;
|
export default layerCategories;
|
||||||
|
|
22
layers/national-land/get_data.sh
Executable file
22
layers/national-land/get_data.sh
Executable file
|
@ -0,0 +1,22 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
curl --silent --output nps_boundary_geojson.zip http://gstore.unm.edu/apps/rgisarchive/datasets/7bbe8af5-029b-4adf-b06c-134f0dd57226/nps_boundary.derived.geojson
|
||||||
|
unzip nps_boundary_geojson.zip nps_boundary.geojson
|
||||||
|
rm nps_boundary_geojson.zip
|
||||||
|
|
||||||
|
# for resolution in 20m 5m; do
|
||||||
|
# curl --silent --remote-name https://www2.census.gov/geo/tiger/GENZ2022/shp/cb_2022_us_county_${resolution}.zip
|
||||||
|
# unzip cb_2022_us_county_${resolution}.zip
|
||||||
|
# ogr2ogr -f GeoJSON us-counties-${resolution}.geojson cb_2022_us_county_${resolution}.shp
|
||||||
|
# sed -i '/^"crs":/d' us-counties-${resolution}.geojson # TODO: handle this projection properly
|
||||||
|
# rm cb_2022_us_county_${resolution}.*
|
||||||
|
# # python cleanup_data.py us-counties-${resolution}.geojson # Only needed for KML files
|
||||||
|
# done
|
||||||
|
|
||||||
|
# https://data.fs.usda.gov/geodata/edw/datasets.php?xmlKeyword=Original+Proclaimed+National+Forests
|
||||||
|
curl --silent --remote-name https://data.fs.usda.gov/geodata/edw/edw_resources/shp/S_USA.ProclaimedForest.zip
|
||||||
|
unzip S_USA.ProclaimedForest.zip
|
||||||
|
ogr2ogr -f GeoJSON us-national-forests.geojson S_USA.ProclaimedForest.shp
|
||||||
|
sed -i '/^"crs":/d' us-national-forests.geojson # TODO: handle this projection properly
|
||||||
|
rm S_USA.ProclaimedForest.*
|
||||||
|
# TODO: some kind of cleanup to save space?
|
51
layers/national-land/index.js
Normal file
51
layers/national-land/index.js
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
import GeoJSON from 'ol/format/GeoJSON.js';
|
||||||
|
import VectorLayer from 'ol/layer/Vector.js';
|
||||||
|
import VectorSource from 'ol/source/Vector.js';
|
||||||
|
|
||||||
|
import nationalParks from './nps_boundary.geojson?url';
|
||||||
|
import nationalForests from './us-national-forests.geojson?url';
|
||||||
|
|
||||||
|
import { Fill, Stroke, Style, Text } from 'ol/style.js';
|
||||||
|
|
||||||
|
function style(feature){
|
||||||
|
return new Style({
|
||||||
|
text: new Text({
|
||||||
|
text: feature.get('FORESTNAME') || (feature.get('UNIT_NAME') + " National Park"),
|
||||||
|
}),
|
||||||
|
fill: new Fill({
|
||||||
|
color: 'rgba(255,255,255,0.4)',
|
||||||
|
}),
|
||||||
|
stroke: new Stroke({
|
||||||
|
color: '#008800',
|
||||||
|
width: 1.25,
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const layers = {
|
||||||
|
name: "US Public Land",
|
||||||
|
layers: [
|
||||||
|
{
|
||||||
|
name: "National Parks",
|
||||||
|
layer: new VectorLayer({
|
||||||
|
source: new VectorSource({
|
||||||
|
url: nationalParks,
|
||||||
|
format: new GeoJSON(),
|
||||||
|
}),
|
||||||
|
style: style,
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "National Forests",
|
||||||
|
layer: new VectorLayer({
|
||||||
|
source: new VectorSource({
|
||||||
|
url: nationalForests,
|
||||||
|
format: new GeoJSON(),
|
||||||
|
}),
|
||||||
|
style: style,
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
export default layers;
|
2
main.js
2
main.js
|
@ -26,7 +26,7 @@ const map = new Map({
|
||||||
for (let category of layerCategories) {
|
for (let category of layerCategories) {
|
||||||
const catDiv = document.createElement("div");
|
const catDiv = document.createElement("div");
|
||||||
catDiv.innerHTML = `
|
catDiv.innerHTML = `
|
||||||
<details open>
|
<details ${category.layers.filter(l => l.enabled).length > 0 ? "open" : ""}>
|
||||||
<summary>${category.name}</summary>
|
<summary>${category.name}</summary>
|
||||||
<ul></ul>
|
<ul></ul>
|
||||||
</details>
|
</details>
|
||||||
|
|
17
style.css
17
style.css
|
@ -1,5 +1,10 @@
|
||||||
@import "node_modules/ol/ol.css";
|
@import "node_modules/ol/ol.css";
|
||||||
|
|
||||||
|
html, body {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
#map {
|
#map {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
|
@ -10,13 +15,19 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav-open #map {
|
.nav-open #map {
|
||||||
left: min(max(200px, 20%), 400px);
|
left: min(max(300px, 20%), 400px);
|
||||||
}
|
}
|
||||||
|
|
||||||
aside {
|
aside {
|
||||||
width: min(max(200px, 20%), 400px);
|
width: min(max(300px, 20%), 400px);
|
||||||
margin-left: max(min(-200px, -20%), -400px);
|
margin-left: max(min(-300px, -20%), -400px);
|
||||||
transition: 0.25s;
|
transition: 0.25s;
|
||||||
|
max-height: 100vh;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
aside > div {
|
||||||
|
padding: 0 0.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav-open aside {
|
.nav-open aside {
|
||||||
|
|
Loading…
Reference in a new issue