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:
Chandler Swift 2023-07-25 19:12:30 -05:00
parent c74edcb8c0
commit 7957523c3c
Signed by: chandlerswift
GPG key ID: A851D929D52FB93F
21 changed files with 49 additions and 51 deletions

View file

@ -66,5 +66,5 @@ geojson = {
"features": stores,
}
with open("culvers-data.geojson", "w") as f:
with open("data.geojson", "w") as f:
f.write(json.dumps(geojson))

View file

@ -5,18 +5,18 @@ import GeoJSON from 'ol/format/GeoJSON.js';
import {Style} from 'ol/style.js';
import Icon from 'ol/style/Icon.js';
import culversURL from '/data/culvers-data.geojson?url'; // TODO: remove `?url`?
import pinURL from './pin.svg?url'; // TODO: remove `?url`?
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: culversURL,
url: url,
format: new GeoJSON,
}),
style: new Style({
image: new Icon({
anchor: [0.5, 1],
src: pinURL,
src: pin,
}),
}),
});

View file

@ -31,7 +31,7 @@ geojson = {
"features": stores,
}
with open("krispy-kreme-data.geojson", "w") as f:
with open("data.geojson", "w") as f:
f.write(json.dumps(geojson))
print(f"{len(locations)} locations found")

View file

@ -5,18 +5,18 @@ import GeoJSON from 'ol/format/GeoJSON.js';
import {Style} from 'ol/style.js';
import Icon from 'ol/style/Icon.js';
import waffleHouseURL from '/data/krispy-kreme-data.geojson?url'; // TODO: remove `?url`?
import pinURL from './pin.svg?url'; // TODO: remove `?url`?
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: waffleHouseURL,
url: url,
format: new GeoJSON,
}),
style: new Style({
image: new Icon({
anchor: [0.5, 1],
src: pinURL,
src: pin,
}),
}),
});

View file

@ -4,7 +4,6 @@ import requests
import json
from bs4 import BeautifulSoup
print("Searching for Kwik Trip locations")
response = requests.get('https://www.kwiktrip.com/Maps-Downloads/Store-List')
# HACK HACK HACK
@ -44,5 +43,5 @@ geojson = {
"features": stores,
}
with open("kwik-trip-data.geojson", "w") as f:
with open("./data.geojson", "w") as f:
f.write(json.dumps(geojson))

View file

@ -5,18 +5,18 @@ import GeoJSON from 'ol/format/GeoJSON.js';
import {Style} from 'ol/style.js';
import Icon from 'ol/style/Icon.js';
import kwikTripURL from '/data/kwik-trip-data.geojson?url'; // TODO: remove `?url`?
import pinURL from './pin.svg?url'; // TODO: remove `?url`?
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: kwikTripURL,
url: url,
format: new GeoJSON,
}),
style: new Style({
image: new Icon({
anchor: [0.5, 1],
src: pinURL,
src: pin,
}),
}),
});

View file

@ -52,7 +52,7 @@ geojson = {
"features": stores,
}
with open("menards-data.geojson", "w") as f:
with open("data.geojson", "w") as f:
f.write(json.dumps(geojson))
print(f"{len(menardses)} locations found")

View file

@ -5,18 +5,18 @@ import GeoJSON from 'ol/format/GeoJSON.js';
import {Style} from 'ol/style.js';
import Icon from 'ol/style/Icon.js';
import menardsURL from '/data/menards-data.geojson?url'; // TODO: remove `?url`?
import pinURL from './pin.svg?url'; // TODO: remove `?url`?
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: menardsURL,
url: url,
format: new GeoJSON,
}),
style: new Style({
image: new Icon({
anchor: [0.5, 1],
src: pinURL,
src: pin,
}),
}),
});

View file

@ -4,8 +4,6 @@ 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={
@ -39,5 +37,7 @@ geojson = {
"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))

View file

@ -5,7 +5,7 @@ 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 url from './data.geojson?url'; // TODO: remove `?url`?
import pin from './pin.svg?url'; // TODO: remove `?url`?
const vectorLayer = new VectorLayer({

View file

@ -35,7 +35,7 @@ geojson = {
"features": stores,
}
with open("waffle-house-data.geojson", "w") as f:
with open("data.geojson", "w") as f:
f.write(json.dumps(geojson))
print(f"{len(locations)} locations found")

View file

@ -5,18 +5,18 @@ import GeoJSON from 'ol/format/GeoJSON.js';
import {Style} from 'ol/style.js';
import Icon from 'ol/style/Icon.js';
import waffleHouseURL from '/data/waffle-house-data.geojson?url'; // TODO: remove `?url`?
import pinURL from './pin.svg?url'; // TODO: remove `?url`?
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: waffleHouseURL,
url: url,
format: new GeoJSON,
}),
style: new Style({
image: new Icon({
anchor: [0.5, 1],
src: pinURL,
src: pin,
}),
}),
});