geo-polyline-tools
Version:
A javaScript library that provides utility functions to encode and decode polyline coordinates
28 lines (22 loc) • 655 B
TypeScript
// index.d.ts
// Type definition for Geometry object
type Geometry = {
type: string;
coordinates: number[][];
};
// Type definition for GeoJSON object
type GeoJSON = {
type: string;
geometry?: Geometry;
};
// Type definition for Polyline object
type Polyline = {
toGeoJSON: (str: string, precision?: number) => Geometry;
fromGeoJSON: (geojson: GeoJSON, precision?: number) => string;
decode: (str: string, precision?: number) => number[][];
encode: (coords: number[][], precision?: number) => string;
};
// Exporting the polyline object as default
declare const polyline: Polyline;
// Exporting the polyline object
export = polyline;