index.d.ts 846 B

12345678910111213141516171819202122232425
  1. import { BBox } from 'geojson';
  2. import { AllGeoJSON } from '@turf/helpers';
  3. /**
  4. * Calculates the bounding box for any GeoJSON object, including FeatureCollection.
  5. * Uses geojson.bbox if available and options.recompute is not set.
  6. *
  7. * @function
  8. * @param {GeoJSON} geojson any GeoJSON object
  9. * @param {Object} [options={}] Optional parameters
  10. * @param {boolean} [options.recompute] Whether to ignore an existing bbox property on geojson
  11. * @returns {BBox} bbox extent in [minX, minY, maxX, maxY] order
  12. * @example
  13. * var line = turf.lineString([[-74, 40], [-78, 42], [-82, 35]]);
  14. * var bbox = turf.bbox(line);
  15. * var bboxPolygon = turf.bboxPolygon(bbox);
  16. *
  17. * //addToMap
  18. * var addToMap = [line, bboxPolygon]
  19. */
  20. declare function bbox(geojson: AllGeoJSON, options?: {
  21. recompute?: boolean;
  22. }): BBox;
  23. export { bbox, bbox as default };