-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start a very simple buffer-around-route feature
- Loading branch information
1 parent
fad6838
commit a8f075c
Showing
10 changed files
with
244 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<script lang="ts"> | ||
import { GeoJSON, LineLayer } from "svelte-maplibre"; | ||
import { SplitComponent } from "svelte-utils/top_bar_layout"; | ||
import { mode } from "./stores"; | ||
import type { FeatureCollection } from "geojson"; | ||
import { makeColorRamp, Popup } from "svelte-utils/map"; | ||
import { SequentialLegend } from "svelte-utils"; | ||
import { colorScale } from "./colors"; | ||
export let gj: FeatureCollection; | ||
let limitsMinutes = [0, 1, 2, 3, 4, 5]; | ||
let limitsSeconds = limitsMinutes.map((x) => x * 60); | ||
</script> | ||
|
||
<SplitComponent> | ||
<div slot="top"> | ||
<button on:click={() => ($mode = { kind: "route" })}>Back</button> | ||
</div> | ||
<div slot="sidebar"> | ||
<h2>Buffer around a route</h2> | ||
<SequentialLegend {colorScale} limits={limitsMinutes} /> | ||
</div> | ||
<div slot="map"> | ||
<GeoJSON data={gj}> | ||
<LineLayer | ||
paint={{ | ||
"line-width": 20, | ||
"line-color": [ | ||
"case", | ||
["==", ["get", "kind"], "route"], | ||
"red", | ||
makeColorRamp(["get", "cost_seconds"], limitsSeconds, colorScale), | ||
], | ||
"line-opacity": 0.5, | ||
}} | ||
> | ||
<Popup openOn="hover" let:props> | ||
{#if props.kind == "buffer"} | ||
{(props.cost_seconds / 60).toFixed(1)} minutes away | ||
{:else} | ||
part of the route | ||
{/if} | ||
</Popup> | ||
</LineLayer> | ||
</GeoJSON> | ||
</div> | ||
</SplitComponent> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters