index.d.cts 918 B

123456789101112131415161718192021222324
  1. import { Feature, FeatureCollection, GeometryCollection } from 'geojson';
  2. import { Units } from '@turf/helpers';
  3. /**
  4. * Takes a {@link GeoJSON} and measures its length in the specified units, {@link (Multi)Point}'s distance are ignored.
  5. *
  6. * @function
  7. * @param {Feature<LineString|MultiLineString>} geojson GeoJSON to measure
  8. * @param {Object} [options={}] Optional parameters
  9. * @param {string} [options.units=kilometers] can be degrees, radians, miles, or kilometers
  10. * @returns {number} length of GeoJSON
  11. * @example
  12. * var line = turf.lineString([[115, -32], [131, -22], [143, -25], [150, -34]]);
  13. * var length = turf.length(line, {units: 'miles'});
  14. *
  15. * //addToMap
  16. * var addToMap = [line];
  17. * line.properties.distance = length;
  18. */
  19. declare function length(geojson: Feature<any> | FeatureCollection<any> | GeometryCollection, options?: {
  20. units?: Units;
  21. }): number;
  22. export { length as default, length };