feat: fetch metadata from pmtiles
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
import { LNV_SERVER } from "$lib/services/hosts";
|
||||
import { routing } from "$lib/services/navigation/routing.svelte";
|
||||
import { getTransportationMeta } from "$lib/services/TileMeta";
|
||||
import type { WrappedValue } from "$lib/services/stores.svelte";
|
||||
import { getMeta } from "$lib/services/TileMeta";
|
||||
import { map } from "./map.svelte";
|
||||
|
||||
export const location = $state({
|
||||
@ -40,7 +41,7 @@ export function isDriving() {
|
||||
return _isDriving;
|
||||
}
|
||||
|
||||
const roadMetadata = $derived(getTransportationMeta({ lat: location.lat, lon: location.lng }));
|
||||
const roadMetadata: WrappedValue<GeoJSON.GeoJsonProperties> = $state({ current: null });
|
||||
|
||||
export function getRoadMetadata() {
|
||||
return roadMetadata;
|
||||
@ -59,6 +60,10 @@ export function watchLocation() {
|
||||
location.available = true;
|
||||
location.heading = pos.coords.heading;
|
||||
location.lastUpdate = new Date();
|
||||
|
||||
getMeta({ lat: location.lat, lon: location.lng }, "transportation").then((meta) => {
|
||||
roadMetadata.current = meta;
|
||||
});
|
||||
|
||||
if (location.locked) {
|
||||
map.value?.flyTo(
|
||||
|
||||
Reference in New Issue
Block a user