diff --git a/layers/chains/country-kitchen/get_data.py b/layers/chains/country-kitchen/get_data.py deleted file mode 100755 index ad81cbb..0000000 --- a/layers/chains/country-kitchen/get_data.py +++ /dev/null @@ -1,50 +0,0 @@ -#!/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)) diff --git a/layers/chains/country-kitchen/layer.js b/layers/chains/country-kitchen/layer.js deleted file mode 100644 index af140b4..0000000 --- a/layers/chains/country-kitchen/layer.js +++ /dev/null @@ -1,24 +0,0 @@ -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/country-kitchen/pin.svg b/layers/chains/country-kitchen/pin.svg deleted file mode 100644 index ef37b03..0000000 --- a/layers/chains/country-kitchen/pin.svg +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - - - - - diff --git a/layers/chains/index.js b/layers/chains/index.js index 6ad85f2..d27025c 100644 --- a/layers/chains/index.js +++ b/layers/chains/index.js @@ -1,20 +1,14 @@ -import countryKitchenLayer from './country-kitchen/layer.js'; import culversLayer from './culvers/layer.js'; import krispyKremeLayer from './krispy-kreme/layer.js'; import kwikTripLayer from './kwik-trip/layer.js'; import menardsLayer from './menards/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 whataburgerLayer from './whataburger/layer.js'; const chains = { name: "Chains", layers: [ - { - name: "Country Kitchen", - layer: countryKitchenLayer, - }, { name: "Culver's", layer: culversLayer, @@ -35,10 +29,6 @@ const chains = { name: "Milwaukee Burger Company", layer: milwaukeeBurgerCompanyLayer, }, - { - name: "Punch Pizza", - layer: punchPizzaLayer, - }, { name: "Waffle House", layer: waffleHouseLayer, diff --git a/layers/chains/punch-pizza/get_data.py b/layers/chains/punch-pizza/get_data.py deleted file mode 100755 index 63a3b82..0000000 --- a/layers/chains/punch-pizza/get_data.py +++ /dev/null @@ -1,43 +0,0 @@ -#!/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)) diff --git a/layers/chains/punch-pizza/layer.js b/layers/chains/punch-pizza/layer.js deleted file mode 100644 index 96b894e..0000000 --- a/layers/chains/punch-pizza/layer.js +++ /dev/null @@ -1,24 +0,0 @@ -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; diff --git a/layers/chains/punch-pizza/pin.svg b/layers/chains/punch-pizza/pin.svg deleted file mode 100644 index 0b526c5..0000000 --- a/layers/chains/punch-pizza/pin.svg +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - - - - - - diff --git a/layers/index.js b/layers/index.js index eef17c8..9a7fe5f 100644 --- a/layers/index.js +++ b/layers/index.js @@ -9,7 +9,6 @@ import bikepackingLayer from './bikepacking/layer.js'; import chains from './chains/index.js'; import census_bureau from './census-bureau/index.js'; import states from './states/index.js'; -import national_land from './national-land/index.js'; const layerCategories = [ { // Base maps @@ -76,7 +75,6 @@ const layerCategories = [ chains, census_bureau, states, - national_land, ]; export default layerCategories; diff --git a/layers/national-land/get_data.sh b/layers/national-land/get_data.sh deleted file mode 100755 index ea0f24f..0000000 --- a/layers/national-land/get_data.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/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? diff --git a/layers/national-land/index.js b/layers/national-land/index.js deleted file mode 100644 index 20df671..0000000 --- a/layers/national-land/index.js +++ /dev/null @@ -1,51 +0,0 @@ -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; diff --git a/main.js b/main.js index b44d4d9..e071a85 100644 --- a/main.js +++ b/main.js @@ -26,7 +26,7 @@ const map = new Map({ for (let category of layerCategories) { const catDiv = document.createElement("div"); catDiv.innerHTML = ` -
l.enabled).length > 0 ? "open" : ""}> +
${category.name}
diff --git a/style.css b/style.css index b1beee7..f82d90d 100644 --- a/style.css +++ b/style.css @@ -1,10 +1,5 @@ @import "node_modules/ol/ol.css"; -html, body { - margin: 0; - padding: 0; -} - #map { position: absolute; top: 0; @@ -15,19 +10,13 @@ html, body { } .nav-open #map { - left: min(max(300px, 20%), 400px); + left: min(max(200px, 20%), 400px); } aside { - width: min(max(300px, 20%), 400px); - margin-left: max(min(-300px, -20%), -400px); + width: min(max(200px, 20%), 400px); + margin-left: max(min(-200px, -20%), -400px); transition: 0.25s; - max-height: 100vh; - overflow-y: auto; -} - -aside > div { - padding: 0 0.5em; } .nav-open aside {