Skip to main content

routeLines

#e31837
import { loadLeague } from "@sportsdataverse/sdvplot";
import { routeLines } from "@sportsdataverse/sdvplot/maplibre";

await loadLeague("nfl");
// Kansas City to Buffalo, airport to airport (nflverse nfldata airports.csv): week 11 of 2024
const leg = { team: "KC", lon: -94.714, lat: 39.297, lon_end: -78.732, lat_end: 42.94 };
const routes = routeLines([leg], { x: "lon", y: "lat", xend: "lon_end", yend: "lat_end", team: "team", league: "nfl" });
// in the browser: map.addSource(routes.id, routes.source); map.addLayer(routes.layer)
routes.source.data.features[0]?.properties.color;

Tags: docstring · routeLines. All sdvplot examples.