-
Notifications
You must be signed in to change notification settings - Fork 187
/
Copy pathcentroid.d.ts
30 lines (27 loc) · 1.15 KB
/
centroid.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import type {ChannelTransform, ChannelValue} from "../channel.js";
import type {Initialized} from "./basic.js";
/** Options for the centroid and geoCentroid transforms. */
export interface CentroidOptions {
/**
* A channel supplying GeoJSON geometry; defaults to the identity transform,
* assuming that the data is GeoJSON geometry.
*/
geometry?: ChannelValue;
}
/**
* Given a **geometry** input channel of GeoJSON geometry, derives **x** and
* **y** output channels representing the planar (projected) centroids of the
* geometry. The centroids are computed in screen coordinates according to the
* plot’s associated **projection** (or *x* and *y* scales), if any.
*
* For centroids of spherical geometry, see Plot.geoCentroid.
*/
export function centroid<T>(options?: T & CentroidOptions): Initialized<T>;
/**
* Given a **geometry** input channel of spherical GeoJSON geometry, derives
* **x** and **y** output channels representing the spherical centroids of the
* geometry.
*
* For planar (projected) centroids, see Plot.centroid.
*/
export function geoCentroid<T>(options?: T & CentroidOptions): T & {x: ChannelTransform; y: ChannelTransform};