index.d.ts 1.1 KB

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