index.d.ts 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import { AllGeoJSON } from '@turf/helpers';
  2. /**
  3. * Takes a {@link GeoJSON} object and returns a simplified version. Internally uses the 2d version of
  4. * [simplify-js](http://mourner.github.io/simplify-js/) to perform simplification using the Ramer-Douglas-Peucker algorithm.
  5. *
  6. *
  7. * @function
  8. * @param {GeoJSON} geojson object to be simplified
  9. * @param {Object} [options={}] Optional parameters
  10. * @param {number} [options.tolerance=1] simplification tolerance
  11. * @param {boolean} [options.highQuality=false] whether or not to spend more time to create a higher-quality simplification with a different algorithm
  12. * @param {boolean} [options.mutate=false] allows GeoJSON input to be mutated (significant performance increase if true)
  13. * @returns {GeoJSON} a simplified GeoJSON
  14. * @example
  15. * var geojson = turf.polygon([[
  16. * [-70.603637, -33.399918],
  17. * [-70.614624, -33.395332],
  18. * [-70.639343, -33.392466],
  19. * [-70.659942, -33.394759],
  20. * [-70.683975, -33.404504],
  21. * [-70.697021, -33.419406],
  22. * [-70.701141, -33.434306],
  23. * [-70.700454, -33.446339],
  24. * [-70.694274, -33.458369],
  25. * [-70.682601, -33.465816],
  26. * [-70.668869, -33.472117],
  27. * [-70.646209, -33.473835],
  28. * [-70.624923, -33.472117],
  29. * [-70.609817, -33.468107],
  30. * [-70.595397, -33.458369],
  31. * [-70.587158, -33.442901],
  32. * [-70.587158, -33.426283],
  33. * [-70.590591, -33.414248],
  34. * [-70.594711, -33.406224],
  35. * [-70.603637, -33.399918]
  36. * ]]);
  37. * var options = {tolerance: 0.01, highQuality: false};
  38. * var simplified = turf.simplify(geojson, options);
  39. *
  40. * //addToMap
  41. * var addToMap = [geojson, simplified]
  42. */
  43. declare function simplify<T extends AllGeoJSON>(geojson: T, options?: {
  44. tolerance?: number;
  45. highQuality?: boolean;
  46. mutate?: boolean;
  47. }): T;
  48. export { simplify as default, simplify };