UNPKG

isoxml

Version:

JavaScript library to parse and generate ISOXML (ISO11783-10) files

35 lines (34 loc) 1.71 kB
import { FeatureCollection } from '@turf/turf'; import { ISOXMLManager } from '../../ISOXMLManager'; import { Entity, XMLElement } from '../../types'; import { Grid, GridAttributes } from '../../baseEntities/Grid'; import { TAGS } from '../../baseEntities/constants'; export type GridParameters = { minX: number; minY: number; numCols: number; numRows: number; cellWidth: number; cellHeight: number; }; export type GridParametersGenerator = (geometry: FeatureCollection) => GridParameters; export type GridGenerator = (featureCollection: FeatureCollection, propertyNames: string[], gridParams: GridParameters) => ArrayBuffer; export declare class ExtendedGrid extends Grid { tag: TAGS; binaryData: Uint8Array; private allReferencedTZNCodes?; constructor(attributes: GridAttributes, isoxmlManager: ISOXMLManager); static fromXML(xml: XMLElement, isoxmlManager: ISOXMLManager, internalId: string): Promise<Entity>; /** Creates Grid of Type 2 */ static fromGeoJSON(geoJSON: FeatureCollection, geoJSONPropertyNames: string[], isoxmlManager: ISOXMLManager, treatmentZoneCode?: number): ExtendedGrid; toXML(): XMLElement; /** Supports only Grid of Type 2 */ toGeoJSON(propertyNames: string[]): FeatureCollection; getAllReferencedTZNCodes(): number[]; /** Verifies that the binary file of this Grid has correct size. * Adds a warning to "isoxmlManager" if the size is incorrect. * @param isoxmlManager - the ISOXMLManager instance to add warnings to * @param pdvCount - the number of ProcessDataVariable in the grid (used for Type 2 grids) * */ verifyGridSize(isoxmlManager: ISOXMLManager, pdvCount: number): void; }