index.d.ts 862 B

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