Skip to main content
Version: 7.0.0

flip

Description

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

Parameters

NameTypeDescription
geojsonGeoJSONinput features
options?ObjectOptional parameters (default {})
options.mutate?booleanallows GeoJSON input to be mutated (significant performance increase if true) (default false)

Returns

    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(...);