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

@mapbox/geojson-rewind

Package Overview
Dependencies
Maintainers
14
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mapbox/geojson-rewind

enforce winding order for geojson

  • 0.5.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
986K
increased by3.57%
Maintainers
14
Weekly downloads
 
Created

What is @mapbox/geojson-rewind?

@mapbox/geojson-rewind is an npm package that allows you to reorient the winding order of GeoJSON polygons to ensure they follow the right-hand rule. This is useful for ensuring compatibility with various GIS systems and tools that expect polygons to be wound in a specific direction.

What are @mapbox/geojson-rewind's main functionalities?

Rewind GeoJSON Polygons

This feature allows you to reorient the winding order of GeoJSON polygons. The `rewind` function takes a GeoJSON object and a boolean indicating whether to reverse the winding order to follow the right-hand rule. The code sample demonstrates how to use the package to rewind a GeoJSON polygon.

const rewind = require('@mapbox/geojson-rewind');
const geojson = {
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "geometry": {
        "type": "Polygon",
        "coordinates": [
          [
            [-101.744384765625, 39.32155002466662],
            [-101.5521240234375, 39.330048552942415],
            [-101.40380859375, 39.330048552942415],
            [-101.33239746093749, 39.364032338047984],
            [-101.041259765625, 39.36827914916011],
            [-100.975341796875, 39.30454987014581],
            [-101.0399169921875, 39.24501680713314],
            [-101.24389648437499, 39.16414104768742],
            [-101.54541015625, 39.178362282029745],
            [-101.744384765625, 39.32155002466662]
          ]
        ]
      }
    }
  ]
};
const rewindedGeojson = rewind(geojson, true);
console.log(JSON.stringify(rewindedGeojson, null, 2));

Other packages similar to @mapbox/geojson-rewind

Keywords

FAQs

Package last updated on 18 May 2022

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