Distribute data with layers instead of data/ dir
This was originally done to make the gitignoring easier, but ended up being somewhat more complex when trying to include files, so they're moving out closer to the point of use.
This commit is contained in:
parent
c74edcb8c0
commit
7957523c3c
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,2 +1,4 @@
|
||||||
node_modules
|
node_modules
|
||||||
dist
|
dist
|
||||||
|
*.geojson
|
||||||
|
*.shp
|
||||||
|
|
9
Makefile
9
Makefile
|
@ -14,4 +14,11 @@ build: # TODO: add get_data as a prereq
|
||||||
# this file much more often. Maybe as things stabilize!
|
# this file much more often. Maybe as things stabilize!
|
||||||
.PHONY: get_data
|
.PHONY: get_data
|
||||||
get_data:
|
get_data:
|
||||||
./data/get_all_data.sh
|
@find ./ -name "get_data.*" \! -executable | grep . >/dev/null \
|
||||||
|
&& echo "Non-executable files found; consider running:" \
|
||||||
|
&& find ./ -name "get_data.*" \! -executable -exec echo " " chmod +x {} \; \
|
||||||
|
&& exit 1 \
|
||||||
|
|| true
|
||||||
|
|
||||||
|
@find ./ -name "get_data.*" -executable \
|
||||||
|
-exec sh -c 'cd $$(dirname {}) && echo processing {}; ./$$(basename {}) | sed --unbuffered "s/^/ /"' \;
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
cd $(dirname $0)
|
|
||||||
|
|
||||||
find ../ -name "get_data.*" \! -executable | grep . >/dev/null \
|
|
||||||
&& echo "Non-executable files found; consider running:" \
|
|
||||||
&& find ../ -name "get_data.*" \! -executable -exec echo chmod +x {} \; \
|
|
||||||
&& exit 1
|
|
||||||
|
|
||||||
find ../ -name "get_data.*" -executable -exec sh -c "echo processing {}; {} | sed --unbuffered 's/^/ /'" \;
|
|
|
@ -1,3 +1,3 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
curl --silent --output amtrak-data.geojson https://maps.amtrak.com/services/MapDataService/stations/nationalRoute
|
curl --silent --output data.geojson https://maps.amtrak.com/services/MapDataService/stations/nationalRoute
|
||||||
|
|
|
@ -4,19 +4,19 @@ import GeoJSON from 'ol/format/GeoJSON.js';
|
||||||
|
|
||||||
import {Style, Stroke} from 'ol/style.js';
|
import {Style, Stroke} from 'ol/style.js';
|
||||||
|
|
||||||
import amtrakURL from '/data/amtrak-data.geojson?url'; // TODO: remove `?url`?
|
import url from './data.geojson?url'; // TODO: remove `?url`?
|
||||||
|
|
||||||
const amtrak_colors = '0,83,126'; // from their website's cookie banner, and other places
|
const colors = '0,83,126'; // from their website's cookie banner, and other places
|
||||||
|
|
||||||
const vectorLayer = new VectorLayer({
|
const vectorLayer = new VectorLayer({
|
||||||
source: new VectorSource({
|
source: new VectorSource({
|
||||||
url: amtrakURL,
|
url: url,
|
||||||
format: new GeoJSON,
|
format: new GeoJSON,
|
||||||
}),
|
}),
|
||||||
style: function(feature, resolution){
|
style: function(feature, resolution){
|
||||||
return new Style({
|
return new Style({
|
||||||
stroke: new Stroke({
|
stroke: new Stroke({
|
||||||
color: `rgba(${amtrak_colors},${Math.min(1, Math.pow(resolution/10, 1/4))})`,
|
color: `rgba(${colors},${Math.min(1, Math.pow(resolution/10, 1/4))})`,
|
||||||
width: 10/Math.pow(resolution, 1/4),
|
width: 10/Math.pow(resolution, 1/4),
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
|
@ -2,4 +2,4 @@
|
||||||
|
|
||||||
# from https://ridewithgps.com/embeds?type=region&id=37
|
# from https://ridewithgps.com/embeds?type=region&id=37
|
||||||
# also https://ridewithgps.com/route_set_overviews/37.json?include_details=1
|
# also https://ridewithgps.com/route_set_overviews/37.json?include_details=1
|
||||||
curl --silent --output bikepacking-data.geojson https://ridewithgps.com/cos/route_set_overviews/simplified_route/37.json
|
curl --silent --output data.geojson https://ridewithgps.com/cos/route_set_overviews/simplified_route/37.json
|
||||||
|
|
|
@ -4,7 +4,7 @@ import GeoJSON from 'ol/format/GeoJSON.js';
|
||||||
|
|
||||||
import {Style, Stroke} from 'ol/style.js';
|
import {Style, Stroke} from 'ol/style.js';
|
||||||
|
|
||||||
import url from '/data/bikepacking-data.geojson?url'; // TODO: remove `?url`?
|
import url from './data.geojson?url'; // TODO: remove `?url`?
|
||||||
|
|
||||||
const colors = '0,0,0'; // from their website's cookie banner, and other places
|
const colors = '0,0,0'; // from their website's cookie banner, and other places
|
||||||
|
|
||||||
|
|
|
@ -66,5 +66,5 @@ geojson = {
|
||||||
"features": stores,
|
"features": stores,
|
||||||
}
|
}
|
||||||
|
|
||||||
with open("culvers-data.geojson", "w") as f:
|
with open("data.geojson", "w") as f:
|
||||||
f.write(json.dumps(geojson))
|
f.write(json.dumps(geojson))
|
||||||
|
|
|
@ -5,18 +5,18 @@ import GeoJSON from 'ol/format/GeoJSON.js';
|
||||||
import {Style} from 'ol/style.js';
|
import {Style} from 'ol/style.js';
|
||||||
import Icon from 'ol/style/Icon.js';
|
import Icon from 'ol/style/Icon.js';
|
||||||
|
|
||||||
import culversURL from '/data/culvers-data.geojson?url'; // TODO: remove `?url`?
|
import url from './data.geojson?url'; // TODO: remove `?url`?
|
||||||
import pinURL from './pin.svg?url'; // TODO: remove `?url`?
|
import pin from './pin.svg?url'; // TODO: remove `?url`?
|
||||||
|
|
||||||
const vectorLayer = new VectorLayer({
|
const vectorLayer = new VectorLayer({
|
||||||
source: new VectorSource({
|
source: new VectorSource({
|
||||||
url: culversURL,
|
url: url,
|
||||||
format: new GeoJSON,
|
format: new GeoJSON,
|
||||||
}),
|
}),
|
||||||
style: new Style({
|
style: new Style({
|
||||||
image: new Icon({
|
image: new Icon({
|
||||||
anchor: [0.5, 1],
|
anchor: [0.5, 1],
|
||||||
src: pinURL,
|
src: pin,
|
||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
|
@ -31,7 +31,7 @@ geojson = {
|
||||||
"features": stores,
|
"features": stores,
|
||||||
}
|
}
|
||||||
|
|
||||||
with open("krispy-kreme-data.geojson", "w") as f:
|
with open("data.geojson", "w") as f:
|
||||||
f.write(json.dumps(geojson))
|
f.write(json.dumps(geojson))
|
||||||
|
|
||||||
print(f"{len(locations)} locations found")
|
print(f"{len(locations)} locations found")
|
||||||
|
|
|
@ -5,18 +5,18 @@ import GeoJSON from 'ol/format/GeoJSON.js';
|
||||||
import {Style} from 'ol/style.js';
|
import {Style} from 'ol/style.js';
|
||||||
import Icon from 'ol/style/Icon.js';
|
import Icon from 'ol/style/Icon.js';
|
||||||
|
|
||||||
import waffleHouseURL from '/data/krispy-kreme-data.geojson?url'; // TODO: remove `?url`?
|
import url from './data.geojson?url'; // TODO: remove `?url`?
|
||||||
import pinURL from './pin.svg?url'; // TODO: remove `?url`?
|
import pin from './pin.svg?url'; // TODO: remove `?url`?
|
||||||
|
|
||||||
const vectorLayer = new VectorLayer({
|
const vectorLayer = new VectorLayer({
|
||||||
source: new VectorSource({
|
source: new VectorSource({
|
||||||
url: waffleHouseURL,
|
url: url,
|
||||||
format: new GeoJSON,
|
format: new GeoJSON,
|
||||||
}),
|
}),
|
||||||
style: new Style({
|
style: new Style({
|
||||||
image: new Icon({
|
image: new Icon({
|
||||||
anchor: [0.5, 1],
|
anchor: [0.5, 1],
|
||||||
src: pinURL,
|
src: pin,
|
||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
|
@ -4,7 +4,6 @@ import requests
|
||||||
import json
|
import json
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
|
|
||||||
print("Searching for Kwik Trip locations")
|
|
||||||
response = requests.get('https://www.kwiktrip.com/Maps-Downloads/Store-List')
|
response = requests.get('https://www.kwiktrip.com/Maps-Downloads/Store-List')
|
||||||
|
|
||||||
# HACK HACK HACK
|
# HACK HACK HACK
|
||||||
|
@ -44,5 +43,5 @@ geojson = {
|
||||||
"features": stores,
|
"features": stores,
|
||||||
}
|
}
|
||||||
|
|
||||||
with open("kwik-trip-data.geojson", "w") as f:
|
with open("./data.geojson", "w") as f:
|
||||||
f.write(json.dumps(geojson))
|
f.write(json.dumps(geojson))
|
||||||
|
|
|
@ -5,18 +5,18 @@ import GeoJSON from 'ol/format/GeoJSON.js';
|
||||||
import {Style} from 'ol/style.js';
|
import {Style} from 'ol/style.js';
|
||||||
import Icon from 'ol/style/Icon.js';
|
import Icon from 'ol/style/Icon.js';
|
||||||
|
|
||||||
import kwikTripURL from '/data/kwik-trip-data.geojson?url'; // TODO: remove `?url`?
|
import url from './data.geojson?url'; // TODO: remove `?url`?
|
||||||
import pinURL from './pin.svg?url'; // TODO: remove `?url`?
|
import pin from './pin.svg?url'; // TODO: remove `?url`?
|
||||||
|
|
||||||
const vectorLayer = new VectorLayer({
|
const vectorLayer = new VectorLayer({
|
||||||
source: new VectorSource({
|
source: new VectorSource({
|
||||||
url: kwikTripURL,
|
url: url,
|
||||||
format: new GeoJSON,
|
format: new GeoJSON,
|
||||||
}),
|
}),
|
||||||
style: new Style({
|
style: new Style({
|
||||||
image: new Icon({
|
image: new Icon({
|
||||||
anchor: [0.5, 1],
|
anchor: [0.5, 1],
|
||||||
src: pinURL,
|
src: pin,
|
||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
|
@ -52,7 +52,7 @@ geojson = {
|
||||||
"features": stores,
|
"features": stores,
|
||||||
}
|
}
|
||||||
|
|
||||||
with open("menards-data.geojson", "w") as f:
|
with open("data.geojson", "w") as f:
|
||||||
f.write(json.dumps(geojson))
|
f.write(json.dumps(geojson))
|
||||||
|
|
||||||
print(f"{len(menardses)} locations found")
|
print(f"{len(menardses)} locations found")
|
||||||
|
|
|
@ -5,18 +5,18 @@ import GeoJSON from 'ol/format/GeoJSON.js';
|
||||||
import {Style} from 'ol/style.js';
|
import {Style} from 'ol/style.js';
|
||||||
import Icon from 'ol/style/Icon.js';
|
import Icon from 'ol/style/Icon.js';
|
||||||
|
|
||||||
import menardsURL from '/data/menards-data.geojson?url'; // TODO: remove `?url`?
|
import url from './data.geojson?url'; // TODO: remove `?url`?
|
||||||
import pinURL from './pin.svg?url'; // TODO: remove `?url`?
|
import pin from './pin.svg?url'; // TODO: remove `?url`?
|
||||||
|
|
||||||
const vectorLayer = new VectorLayer({
|
const vectorLayer = new VectorLayer({
|
||||||
source: new VectorSource({
|
source: new VectorSource({
|
||||||
url: menardsURL,
|
url: url,
|
||||||
format: new GeoJSON,
|
format: new GeoJSON,
|
||||||
}),
|
}),
|
||||||
style: new Style({
|
style: new Style({
|
||||||
image: new Icon({
|
image: new Icon({
|
||||||
anchor: [0.5, 1],
|
anchor: [0.5, 1],
|
||||||
src: pinURL,
|
src: pin,
|
||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
|
@ -4,8 +4,6 @@ import requests
|
||||||
import json
|
import json
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
|
|
||||||
print("Searching for Milwaukee Burger Company locations")
|
|
||||||
|
|
||||||
# Stolen from my machine, appears to work; sufficient and necessary to get
|
# Stolen from my machine, appears to work; sufficient and necessary to get
|
||||||
# around their firewall apparently?
|
# around their firewall apparently?
|
||||||
UA={
|
UA={
|
||||||
|
@ -39,5 +37,7 @@ geojson = {
|
||||||
"features": locations,
|
"features": locations,
|
||||||
}
|
}
|
||||||
|
|
||||||
with open("milwaukee-burger-company-data.geojson", "w") as f:
|
print(len(locations), "locations found")
|
||||||
|
|
||||||
|
with open("data.geojson", "w") as f:
|
||||||
f.write(json.dumps(geojson))
|
f.write(json.dumps(geojson))
|
||||||
|
|
|
@ -5,7 +5,7 @@ import GeoJSON from 'ol/format/GeoJSON.js';
|
||||||
import {Style} from 'ol/style.js';
|
import {Style} from 'ol/style.js';
|
||||||
import Icon from 'ol/style/Icon.js';
|
import Icon from 'ol/style/Icon.js';
|
||||||
|
|
||||||
import url from '/data/milwaukee-burger-company-data.geojson?url'; // TODO: remove `?url`?
|
import url from './data.geojson?url'; // TODO: remove `?url`?
|
||||||
import pin from './pin.svg?url'; // TODO: remove `?url`?
|
import pin from './pin.svg?url'; // TODO: remove `?url`?
|
||||||
|
|
||||||
const vectorLayer = new VectorLayer({
|
const vectorLayer = new VectorLayer({
|
||||||
|
|
|
@ -35,7 +35,7 @@ geojson = {
|
||||||
"features": stores,
|
"features": stores,
|
||||||
}
|
}
|
||||||
|
|
||||||
with open("waffle-house-data.geojson", "w") as f:
|
with open("data.geojson", "w") as f:
|
||||||
f.write(json.dumps(geojson))
|
f.write(json.dumps(geojson))
|
||||||
|
|
||||||
print(f"{len(locations)} locations found")
|
print(f"{len(locations)} locations found")
|
||||||
|
|
|
@ -5,18 +5,18 @@ import GeoJSON from 'ol/format/GeoJSON.js';
|
||||||
import {Style} from 'ol/style.js';
|
import {Style} from 'ol/style.js';
|
||||||
import Icon from 'ol/style/Icon.js';
|
import Icon from 'ol/style/Icon.js';
|
||||||
|
|
||||||
import waffleHouseURL from '/data/waffle-house-data.geojson?url'; // TODO: remove `?url`?
|
import url from './data.geojson?url'; // TODO: remove `?url`?
|
||||||
import pinURL from './pin.svg?url'; // TODO: remove `?url`?
|
import pin from './pin.svg?url'; // TODO: remove `?url`?
|
||||||
|
|
||||||
const vectorLayer = new VectorLayer({
|
const vectorLayer = new VectorLayer({
|
||||||
source: new VectorSource({
|
source: new VectorSource({
|
||||||
url: waffleHouseURL,
|
url: url,
|
||||||
format: new GeoJSON,
|
format: new GeoJSON,
|
||||||
}),
|
}),
|
||||||
style: new Style({
|
style: new Style({
|
||||||
image: new Icon({
|
image: new Icon({
|
||||||
anchor: [0.5, 1],
|
anchor: [0.5, 1],
|
||||||
src: pinURL,
|
src: pin,
|
||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
|
@ -93,5 +93,5 @@ geojson = {
|
||||||
"features": arenas,
|
"features": arenas,
|
||||||
}
|
}
|
||||||
|
|
||||||
with open("nhl-arenas-data.geojson", "w") as f:
|
with open("data.geojson", "w") as f:
|
||||||
f.write(json.dumps(geojson))
|
f.write(json.dumps(geojson))
|
||||||
|
|
|
@ -4,13 +4,13 @@ import GeoJSON from 'ol/format/GeoJSON.js';
|
||||||
|
|
||||||
import {Style, Stroke, Circle, Fill} from 'ol/style.js';
|
import {Style, Stroke, Circle, Fill} from 'ol/style.js';
|
||||||
|
|
||||||
import arenaURL from '/data/nhl-arenas-data.geojson?url'; // TODO: remove `?url`?
|
import url from './data.geojson?url'; // TODO: remove `?url`?
|
||||||
|
|
||||||
import visitedArenas from './visited.js'
|
import visitedArenas from './visited.js'
|
||||||
|
|
||||||
const vectorLayer = new VectorLayer({
|
const vectorLayer = new VectorLayer({
|
||||||
source: new VectorSource({
|
source: new VectorSource({
|
||||||
url: arenaURL,
|
url: url,
|
||||||
format: new GeoJSON,
|
format: new GeoJSON,
|
||||||
}),
|
}),
|
||||||
// TODO: use '✓' and '✗' (or maybe '✔' and '✘') (from https://en.wikipedia.org/wiki/List_of_Unicode_characters#Dingbats)
|
// TODO: use '✓' and '✗' (or maybe '✔' and '✘') (from https://en.wikipedia.org/wiki/List_of_Unicode_characters#Dingbats)
|
||||||
|
|
Loading…
Reference in a new issue