Skip to main content

Function: logoSymbols()

logoSymbols(rows, o): LogoSymbols

Defined in: packages/sdvplot/src/maplibre.ts:201

Each row's team logo at its (longitude, latitude), as a GeoJSON source and a MapLibre symbol layer: one point feature per row (its id is the row's index; team, icon, url and index are its properties), and a layer drawing icon-image: ["get", "icon"], every logo shown even where two overlap. A team with no logo (or one that does not resolve) is left out with one warning; so is a row with a missing, non-numeric or infinite coordinate (a numeric string such as "-94.7" is read as its number). Team values may be numbers or strings (ESPN ids, abbreviations, names). The map needs the logos as images first: await addLogoImages(map, logos), then map.addSource(logos.id, logos.source) and map.addLayer(logos.layer).

Parameters​

rows​

readonly Row[]

o​

LogoSymbolOptions

Returns​

LogoSymbols

Example​

import { loadLeague } from "@sportsdataverse/sdvplot";
import { logoSymbols } from "@sportsdataverse/sdvplot/maplibre";

await loadLeague("nfl");
// Kansas City's home airport, from nflverse's nfldata airports.csv
const logos = logoSymbols([{ team: "KC", lon: -94.714, lat: 39.297 }], {
x: "lon",
y: "lat",
team: "team",
league: "nfl",
size: 40,
});
// in the browser: await addLogoImages(map, logos); map.addSource(logos.id, logos.source); map.addLayer(logos.layer)
logos.source.data.features[0]?.properties.icon;