@loaders.gl/geoarrow
Version:
GeoArrow columnar geometry encoding and decoding
131 lines (112 loc) • 4.47 kB
TypeScript
/**
* @note Conforms to the GeoArrow memory layout
* @see https://geoarrow.org/format.html#memory-layouts
* @note this is aligned with the geoarrow-js library (MIT license)
* @see https://github.com/geoarrow/geoarrow-js/
*/
import { DataType } from 'apache-arrow/type';
import type { GeoArrowPoint, GeoArrowLineString, GeoArrowPolygon, GeoArrowMultiPoint, GeoArrowMultiLineString, GeoArrowMultiPolygon, GeoArrowGeometry } from "./geoarrow-types.js";
/** Checks whether the given Apache Arrow JS type is a Point data type */
export declare function isGeoArrowPoint(type: DataType): type is GeoArrowPoint;
/** Checks whether the given Apache Arrow JS type is a Point data type */
export declare function isGeoArrowLineString(type: DataType): type is GeoArrowLineString;
/** Checks whether the given Apache Arrow JS type is a Polygon data type */
export declare function isGeoArrowPolygon(type: DataType): type is GeoArrowPolygon;
/** Checks whether the given Apache Arrow JS type is a Polygon data type */
export declare function isGeoArrowMultiPoint(type: DataType): type is GeoArrowMultiPoint;
/** Checks whether the given Apache Arrow JS type is a Polygon data type */
export declare function isGeoArrowMultiLineString(type: DataType): type is GeoArrowMultiLineString;
/** Checks whether the given Apache Arrow JS type is a Polygon data type */
export declare function isGeoArrowMultiPolygon(type: DataType): type is GeoArrowMultiPolygon;
/**
* Checks if a given Arrow data type is a valid GeoArrowGeometry
* @note this is somewhat inefficient, it checks the same things multiple times
*/
export declare function isGeoArrowGeometry(type: DataType): type is GeoArrowGeometry;
/**
* Strongly typed accessors for children, since arrow.Data.children[] is untyped
import { Data } from "apache-arrow/data";
import { Vector } from "apache-arrow/vector";
import { Float } from "apache-arrow/type";
import {
LineStringData,
MultiLineStringData,
MultiPointData,
MultiPolygonData,
PointData,
PolygonData,
} from "./data";
import {
LineStringVector,
MultiLineStringVector,
MultiPointVector,
MultiPolygonVector,
PointVector,
PolygonVector,
} from "./vector";
export function getPointChild(input: PointData): Data<Float>;
export function getPointChild(input: PointVector): Vector<Float>;
export function getPointChild(
input: PointData | PointVector,
): Data<Float> | Vector<Float> {
if ("data" in input) {
return input.getChildAt(0)!;
}
return input.children[0] as Data<Float>;
}
export function getLineStringChild(input: LineStringData): PointData;
export function getLineStringChild(input: LineStringVector): PointVector;
export function getLineStringChild(
input: LineStringData | LineStringVector,
): PointData | PointVector {
if ("data" in input) {
return input.getChildAt(0)!;
}
return input.children[0] as PointData;
}
export function getPolygonChild(input: PolygonData): LineStringData;
export function getPolygonChild(input: PolygonVector): LineStringVector;
export function getPolygonChild(
input: PolygonData | PolygonVector,
): LineStringData | LineStringVector {
if ("data" in input) {
return input.getChildAt(0)!;
}
return input.children[0] as LineStringData;
}
export function getMultiPointChild(input: MultiPointData): PointData;
export function getMultiPointChild(input: MultiPointVector): PointVector;
export function getMultiPointChild(
input: MultiPointData | MultiPointVector,
): PointData | PointVector {
if ("data" in input) {
return input.getChildAt(0)!;
}
return input.children[0] as PointData;
}
export function getMultiLineStringChild(
input: MultiLineStringData,
): LineStringData;
export function getMultiLineStringChild(
input: MultiLineStringVector,
): LineStringVector;
export function getMultiLineStringChild(
input: MultiLineStringData | MultiLineStringVector,
): LineStringData | LineStringVector {
if ("data" in input) {
return input.getChildAt(0)!;
}
return input.children[0] as LineStringData;
}
export function getMultiPolygonChild(input: MultiPolygonData): PolygonData;
export function getMultiPolygonChild(input: MultiPolygonVector): PolygonVector;
export function getMultiPolygonChild(
input: MultiPolygonData | MultiPolygonVector,
): PolygonData | PolygonVector {
if ("data" in input) {
return input.getChildAt(0)!;
}
return input.children[0] as PolygonData;
}
*/
//# sourceMappingURL=geoarrow-functions.d.ts.map