import { BinaryFeatureCollection } from '@loaders.gl/schema'; import { Feature } from 'geojson'; import { GeometryCollection, Line, Polygon } from '@geoda/common'; /** * The type of the point layer data. See PointLayerData in kepler.gl */ export type PointLayerData = { position: number[]; index: number; neighbors: number[]; }; /** * The type of the arc layer data. See ArcLayerData in kepler.gl */ export type ArcLayerData = { index: number; sourcePosition: [number, number, number]; targetPosition: [number, number, number]; }; /** * The type of the hexagon id layer data. See HexagonIdLayerData in kepler.gl */ export type HexagonIdLayerData = { index: number; id: number; centroid: [number, number]; }; /** * The type of the geometries used in the GeoDaLib */ export type SpatialGeometry = /** * GeoJSON features */ Feature[] /** * Binary feature collection. Use array of binary features because large binary files are chunked into multiple binary feature collections. */ | BinaryFeatureCollection[] /** * Point layer data */ | PointLayerData[] /** * Arc layer data */ | ArcLayerData[] /** * Hexagon id layer data */ | HexagonIdLayerData[]; export declare function isGeoJsonFeature(geometry: unknown): geometry is Feature; export declare function isBinaryFeatureCollection(geometry: unknown): geometry is BinaryFeatureCollection; export declare function isPointLayerData(geometry: unknown): geometry is PointLayerData; export declare function isArcLayerData(geometry: unknown): geometry is ArcLayerData; export declare function isHexagonIdLayerData(geometry: unknown): geometry is HexagonIdLayerData; export declare enum SpatialJoinGeometryType { GeoJsonFeature = "GeoJsonFeature", BinaryFeatureCollection = "BinaryFeatureCollection", PointLayerData = "PointLayerData", ArcLayerData = "ArcLayerData", HexagonIdLayerData = "HexagonIdLayerData" } /** * Check the type of the geometries * @param geometries - the geometries to check. See {@link SpatialJoinGeometries} for more information. * @returns the type of the geometries. See {@link SpatialJoinGeometryType} for more information. */ export declare function CheckGeometryType(geometries: SpatialGeometry): SpatialJoinGeometryType; /** * Get GeometryCollection from input geometries. The input geometries can be * 1. GeoJSON features * 2. binary feature collections * 3. point layer data * 4. arc layer data * 5. hexagon id layer data * * @example * ```ts * const geoms = [ * { type: 'Feature', geometry: { type: 'Polygon', coordinates: [[[0, 0], [1, 0], [1, 1], [0, 1], [0, 0]]] }, properties: { index: 0 } }, * ]; * const geometryCollection = await getGeometryCollection({ geometries: geoms }); * ``` * @returns GeometryCollection - the geometry collection used in GeoDaLib see src/spatial_features.h */ export declare function getGeometryCollection({ geometries, fixPolygon, convertToUTM, }: { /** input geometries see {@link SpatialGeometry} */ geometries: SpatialGeometry; /** fix polygon */ fixPolygon?: boolean; /** convert to UTM */ convertToUTM?: boolean; }): Promise; /** * Convert a Polygon to a GeoJSON Feature * @param polygon - The polygon to convert * @returns The converted GeoJSON Feature * * @example * ```ts * const polygon = new Polygon(new VectorDouble([0, 0, 1, 0, 1, 1, 0, 1, 0, 0]), new VectorUInt([0, 1, 2, 3, 4]), new VectorUInt([0, 1, 2, 3, 4]), new VectorUInt([0, 1, 2, 3, 4]), true, false); * const feature = await polygonToFeature(polygon); * ``` */ export declare function polygonToFeature(polygon: Polygon): Promise; export declare function lineToFeature(line: Line): Promise;