Compare commits
3 commits
ee147fea3c
...
1bc68692cc
Author | SHA1 | Date | |
---|---|---|---|
|
1bc68692cc | ||
|
f90830ff93 | ||
|
96f1e3bef9 |
1
main.go
1
main.go
|
@ -57,6 +57,7 @@ func main() {
|
||||||
})
|
})
|
||||||
|
|
||||||
http.HandleFunc("GET /api/sidewalks", func(w http.ResponseWriter, r *http.Request) {
|
http.HandleFunc("GET /api/sidewalks", func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
w.Header().Set("Content-Type", "application/json")
|
||||||
json.NewEncoder(w).Encode(sidewalks)
|
json.NewEncoder(w).Encode(sidewalks)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,9 @@
|
||||||
width: 100%;
|
width: 100%;
|
||||||
background-color: black;
|
background-color: black;
|
||||||
}
|
}
|
||||||
|
.grayscale {
|
||||||
|
filter: saturate(0.4);
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
<!-- TODO: self-host -->
|
<!-- TODO: self-host -->
|
||||||
<link rel="stylesheet" href="https://mfhsieh.github.io/leaflet-simple-locate/examples/demo.css" />
|
<link rel="stylesheet" href="https://mfhsieh.github.io/leaflet-simple-locate/examples/demo.css" />
|
||||||
|
@ -31,13 +34,14 @@
|
||||||
// Set up the OpenStreetMap tile layer
|
// Set up the OpenStreetMap tile layer
|
||||||
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||||
opacity: 0.6,
|
opacity: 0.6,
|
||||||
|
className: 'grayscale',
|
||||||
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
||||||
}).addTo(map);
|
}).addTo(map);
|
||||||
|
|
||||||
const CONDITIONS = [
|
const CONDITIONS = [
|
||||||
{name: "Unknown", color: "gray"},
|
{name: "Unknown", color: "#444"},
|
||||||
{name: "Clear", color: "green"},
|
{name: "Clear", color: "#04591b"},
|
||||||
{name: "PartiallyCovered", color: "yellow"},
|
{name: "Partially Covered", color: "yellow"},
|
||||||
{name: "Covered", color: "red"},
|
{name: "Covered", color: "red"},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -49,19 +53,19 @@
|
||||||
for (let [i, way] of osmData.entries()) {
|
for (let [i, way] of osmData.entries()) {
|
||||||
const polyline = L.polyline(way.Geometry, {
|
const polyline = L.polyline(way.Geometry, {
|
||||||
color: CONDITIONS[way.Condition].color,
|
color: CONDITIONS[way.Condition].color,
|
||||||
weight: 5,
|
weight: 10,
|
||||||
opacity: 0.7
|
opacity: 0.7
|
||||||
}).addTo(map);
|
}).addTo(map);
|
||||||
|
|
||||||
polyline.on('mouseover', function(e) {
|
polyline.on('mouseover', function(e) {
|
||||||
e.target.setStyle({
|
e.target.setStyle({
|
||||||
weight: 10,
|
weight: 20,
|
||||||
opacity: 1,
|
opacity: 1,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
polyline.on('mouseout', function(e){
|
polyline.on('mouseout', function(e){
|
||||||
e.target.setStyle({
|
e.target.setStyle({
|
||||||
weight: 5,
|
weight: 10,
|
||||||
opacity: 0.7,
|
opacity: 0.7,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue