index.d.ts 1.2 KB

1234567891011121314151617181920212223242526272829303132
  1. import { AllGeoJSON } from '@turf/helpers';
  2. /**
  3. * Takes a GeoJSON Feature or FeatureCollection and truncates the precision of the geometry.
  4. *
  5. * @function
  6. * @param {GeoJSON} geojson any GeoJSON Feature, FeatureCollection, Geometry or GeometryCollection.
  7. * @param {Object} [options={}] Optional parameters
  8. * @param {number} [options.precision=6] coordinate decimal precision
  9. * @param {number} [options.coordinates=3] maximum number of coordinates (primarly used to remove z coordinates)
  10. * @param {boolean} [options.mutate=false] allows GeoJSON input to be mutated (significant performance increase if true)
  11. * @returns {GeoJSON} layer with truncated geometry
  12. * @example
  13. * var point = turf.point([
  14. * 70.46923055566859,
  15. * 58.11088890802906,
  16. * 1508
  17. * ]);
  18. * var options = {precision: 3, coordinates: 2};
  19. * var truncated = turf.truncate(point, options);
  20. * //=truncated.geometry.coordinates => [70.469, 58.111]
  21. *
  22. * //addToMap
  23. * var addToMap = [truncated];
  24. */
  25. declare function truncate<T extends AllGeoJSON>(geojson: T, options?: {
  26. precision?: number;
  27. coordinates?: number;
  28. mutate?: boolean;
  29. }): T;
  30. export { truncate as default, truncate };