index.d.ts 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import { Position } from 'geojson';
  2. import { AllGeoJSON } from '@turf/helpers';
  3. /**
  4. * Converts a WGS84 GeoJSON object into Mercator (EPSG:900913) projection
  5. *
  6. * @function
  7. * @param {GeoJSON|Position} geojson WGS84 GeoJSON object
  8. * @param {Object} [options] Optional parameters
  9. * @param {boolean} [options.mutate=false] allows GeoJSON input to be mutated (significant performance increase if true)
  10. * @returns {GeoJSON} Projected GeoJSON
  11. * @example
  12. * var pt = turf.point([-71,41]);
  13. * var converted = turf.toMercator(pt);
  14. *
  15. * //addToMap
  16. * var addToMap = [pt, converted];
  17. */
  18. declare function toMercator<G = AllGeoJSON | Position>(geojson: G, options?: {
  19. mutate?: boolean;
  20. }): G;
  21. /**
  22. * Converts a Mercator (EPSG:900913) GeoJSON object into WGS84 projection
  23. *
  24. * @function
  25. * @param {GeoJSON|Position} geojson Mercator GeoJSON object
  26. * @param {Object} [options] Optional parameters
  27. * @param {boolean} [options.mutate=false] allows GeoJSON input to be mutated (significant performance increase if true)
  28. * @returns {GeoJSON} Projected GeoJSON
  29. * @example
  30. * var pt = turf.point([-7903683.846322424, 5012341.663847514]);
  31. * var converted = turf.toWgs84(pt);
  32. *
  33. * //addToMap
  34. * var addToMap = [pt, converted];
  35. */
  36. declare function toWgs84<G = AllGeoJSON | Position>(geojson: G, options?: {
  37. mutate?: boolean;
  38. }): G;
  39. export { toMercator, toWgs84 };