Skip to main content
Version: 7.2.0

flip

描述

¥Description

获取输入要素并将其所有坐标从 [x, y] 翻转为 [y, x]

¥Takes input features and flips all of their coordinates from [x, y] to [y, x].

参数

¥Parameters

名称类型描述
geojsonGeoJSON输入要素
options?对象可选参数(默认 {})
options.mutate?boolean允许 GeoJSON 输入发生修改(如果为 true,则性能显著提升)(默认为 false)

返回

¥Returns

GeoJSONinput 类型相同的要素或要素集,但坐标已翻转

¥GeoJSON a feature or set of features of the same type as input with flipped coordinates

示例

¥Examples

var serbia = turf.point([20.566406, 43.421008]);

var saudiArabia = turf.flip(serbia);

安装

¥Installation

$ npm install @turf/flip

import { flip } from "@turf/flip";
const result = flip(...);
$ npm install @turf/turf

import * as turf from "@turf/turf";
const result = turf.flip(...);