Function: surfaceLayer()
surfaceLayer<
S>(sport,league,o?):SurfaceLayerProps
Defined in: packages/sdvplot/src/deckgl.ts:462
deck.gl PolygonLayer props drawing sporty's playing surface for sport and league (sporty's own league keys,
e.g. surfaceLayer("hockey", "nhl"), surfaceLayer("soccer", "fifa")), in the surface's own coordinates: deck.gl's
"cartesian" coordinate system, in the surface's units (feet for a rink, metres for a pitch) with the origin at its
centre, the frame sporty draws in and NHL api-web's shot coordinates are in. Each closed loop of a polygon feature
is one data row (a faceoff circle is two: its half rings; a loop that crosses itself is split at the crossing into
rings that do not, and a loop with no area is left out), in sporty's drawing order, filled with its colour (alpha
included). sporty's default strokes equal their fills, so
the layer is fill-only; a hidden feature (a #rrggbb00 fill) and text features (a football field's yard numbers)
are left out. o is passed to sporty's surface() (updates, colorUpdates, units, rotation, ...); sporty's
own errors escape unwrapped. Draw it with deck.gl's OrthographicView.
Type Parameters
S
S extends Sport
Parameters
sport
S
league
LeagueOf<S>
o?
SurfaceLayerOptions<S> = ...
Returns
Example
import { surfaceLayer } from "@sportsdataverse/sdvplot/deckgl";
const rink = surfaceLayer("hockey", "nhl");
// in the browser: new PolygonLayer(rink), in a Deck with views: new OrthographicView({ flipY: false })
rink.data.length;