index.d.cts 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. import { GeoJsonProperties, BBox, Feature, Point } from 'geojson';
  2. import { AllGeoJSON, Id } from '@turf/helpers';
  3. /**
  4. * Takes a {@link Feature} or {@link FeatureCollection} and returns the absolute center point of all features.
  5. *
  6. * @function
  7. * @param {GeoJSON} geojson GeoJSON to be centered
  8. * @param {Object} [options={}] Optional parameters
  9. * @param {Object} [options.properties={}] Translate GeoJSON Properties to Point
  10. * @param {Object} [options.bbox={}] Translate GeoJSON BBox to Point
  11. * @param {Object} [options.id={}] Translate GeoJSON Id to Point
  12. * @returns {Feature<Point>} a Point feature at the absolute center point of all input features
  13. * @example
  14. * var features = turf.points([
  15. * [-97.522259, 35.4691],
  16. * [-97.502754, 35.463455],
  17. * [-97.508269, 35.463245]
  18. * ]);
  19. *
  20. * var center = turf.center(features);
  21. *
  22. * //addToMap
  23. * var addToMap = [features, center]
  24. * center.properties['marker-size'] = 'large';
  25. * center.properties['marker-color'] = '#000';
  26. */
  27. declare function center<P extends GeoJsonProperties = GeoJsonProperties>(geojson: AllGeoJSON, options?: {
  28. properties?: P;
  29. bbox?: BBox;
  30. id?: Id;
  31. }): Feature<Point, P>;
  32. export { center, center as default };