UNPKG

gis-tools-ts

Version:

A collection of geospatial tools primarily designed for WGS84, Web Mercator, and S2.

38 lines 1.06 kB
export * from './along.js'; export * from './area.js'; export * from './clean.js'; export * from './equal.js'; export * from './intersection.js'; export * from './length.js'; export * from './pointOnLine.js'; export * from './pointToLineDistance.js'; /** * Given an input vector feature, create a collection of lines * @param data - vector feature with various geometry types * @returns - all features as a collection of points */ export function toLines(data) { const { type, is3D, coordinates } = data.geometry; const res = []; if (type === 'Point' || type === 'MultiPoint') { return; } else if (type === 'LineString') { res.push(coordinates); } else if (type === 'MultiLineString') { res.push(...coordinates); } else if (type === 'Polygon') { res.push(...coordinates); } else if (type === 'MultiPolygon') { res.push(...coordinates.flat()); } return { type: 'MultiLineString', is3D, coordinates: res, }; } //# sourceMappingURL=index.js.map