Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@turf/flip

Package Overview
Dependencies
Maintainers
9
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@turf/flip

turf flip module

  • 7.1.0
  • unpublished
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
802K
increased by32.15%
Maintainers
9
Weekly downloads
 
Created

What is @turf/flip?

@turf/flip is a module in the Turf.js library that allows you to flip the coordinates of GeoJSON objects. This is useful when you need to switch the order of latitude and longitude coordinates.

What are @turf/flip's main functionalities?

Flip Coordinates of a Point

This feature allows you to flip the coordinates of a GeoJSON Point object. The code sample demonstrates how to flip the coordinates of a point from [120.0, 30.0] to [30.0, 120.0].

const turf = require('@turf/turf');
const point = turf.point([120.0, 30.0]);
const flippedPoint = turf.flip(point);
console.log(flippedPoint);

Flip Coordinates of a LineString

This feature allows you to flip the coordinates of a GeoJSON LineString object. The code sample demonstrates how to flip the coordinates of a line from [[120.0, 30.0], [121.0, 31.0]] to [[30.0, 120.0], [31.0, 121.0]].

const turf = require('@turf/turf');
const line = turf.lineString([[120.0, 30.0], [121.0, 31.0]]);
const flippedLine = turf.flip(line);
console.log(flippedLine);

Flip Coordinates of a Polygon

This feature allows you to flip the coordinates of a GeoJSON Polygon object. The code sample demonstrates how to flip the coordinates of a polygon from [[[120.0, 30.0], [121.0, 31.0], [122.0, 32.0], [120.0, 30.0]]] to [[[30.0, 120.0], [31.0, 121.0], [32.0, 122.0], [30.0, 120.0]]].

const turf = require('@turf/turf');
const polygon = turf.polygon([[[120.0, 30.0], [121.0, 31.0], [122.0, 32.0], [120.0, 30.0]]]);
const flippedPolygon = turf.flip(polygon);
console.log(flippedPolygon);

Other packages similar to @turf/flip

Keywords

FAQs

Package last updated on 09 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc