123456789101112131415161718192021222324252627282930 |
- import { AllGeoJSON } from "@turf/helpers";
- /**
- * Takes a GeoJSON Feature or FeatureCollection and truncates the precision of the geometry.
- *
- * @name truncate
- * @param {GeoJSON} geojson any GeoJSON Feature, FeatureCollection, Geometry or GeometryCollection.
- * @param {Object} [options={}] Optional parameters
- * @param {number} [options.precision=6] coordinate decimal precision
- * @param {number} [options.coordinates=3] maximum number of coordinates (primarly used to remove z coordinates)
- * @param {boolean} [options.mutate=false] allows GeoJSON input to be mutated (significant performance increase if true)
- * @returns {GeoJSON} layer with truncated geometry
- * @example
- * var point = turf.point([
- * 70.46923055566859,
- * 58.11088890802906,
- * 1508
- * ]);
- * var options = {precision: 3, coordinates: 2};
- * var truncated = turf.truncate(point, options);
- * //=truncated.geometry.coordinates => [70.469, 58.111]
- *
- * //addToMap
- * var addToMap = [truncated];
- */
- declare function truncate<T extends AllGeoJSON>(geojson: T, options?: {
- precision?: number;
- coordinates?: number;
- mutate?: boolean;
- }): T;
- export default truncate;
|