Add bikepacking routes layer
This commit is contained in:
parent
e203a93478
commit
f3f7a21645
5
layers/bikepacking/get_data.sh
Executable file
5
layers/bikepacking/get_data.sh
Executable file
|
@ -0,0 +1,5 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# from https://ridewithgps.com/embeds?type=region&id=37
|
||||||
|
# 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
|
26
layers/bikepacking/layer.js
Normal file
26
layers/bikepacking/layer.js
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
import VectorLayer from 'ol/layer/Vector';
|
||||||
|
import {Vector as VectorSource} from 'ol/source.js';
|
||||||
|
import GeoJSON from 'ol/format/GeoJSON.js';
|
||||||
|
|
||||||
|
import {Style, Stroke} from 'ol/style.js';
|
||||||
|
|
||||||
|
import url from '/data/bikepacking-data.geojson?url'; // TODO: remove `?url`?
|
||||||
|
|
||||||
|
const colors = '0,0,0'; // from their website's cookie banner, and other places
|
||||||
|
|
||||||
|
const vectorLayer = new VectorLayer({
|
||||||
|
source: new VectorSource({
|
||||||
|
url: url,
|
||||||
|
format: new GeoJSON,
|
||||||
|
}),
|
||||||
|
style: function(feature, resolution){
|
||||||
|
return new Style({
|
||||||
|
stroke: new Stroke({
|
||||||
|
color: `rgba(${colors},${Math.min(1, Math.pow(resolution/10, 1/4))})`,
|
||||||
|
width: 10/Math.pow(resolution, 1/4),
|
||||||
|
})
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export default vectorLayer;
|
|
@ -11,6 +11,7 @@ import kwikTripLayer from './kwik-trip/layer.js';
|
||||||
import waffleHouseLayer from './waffle-house/layer.js';
|
import waffleHouseLayer from './waffle-house/layer.js';
|
||||||
import krispyKremeLayer from './krispy-kreme/layer.js';
|
import krispyKremeLayer from './krispy-kreme/layer.js';
|
||||||
import milwaukeeBurgerCompanyLayer from './milwaukee-burger-company/layer.js';
|
import milwaukeeBurgerCompanyLayer from './milwaukee-burger-company/layer.js';
|
||||||
|
import bikepackingLayer from './bikepacking/layer.js';
|
||||||
|
|
||||||
const layerCategories = [
|
const layerCategories = [
|
||||||
{
|
{
|
||||||
|
@ -92,6 +93,10 @@ const layerCategories = [
|
||||||
name: "Milwaukee Burger Company",
|
name: "Milwaukee Burger Company",
|
||||||
layer: milwaukeeBurgerCompanyLayer,
|
layer: milwaukeeBurgerCompanyLayer,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "Bikepacking.com Routes",
|
||||||
|
layer: bikepackingLayer,
|
||||||
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
Loading…
Reference in a new issue