![Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts](https://cdn.sanity.io/images/cgdhsj6q/production/1ba0de113c804fecef80d5f68add3d625becba39-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
@mapbox/geojson-rewind
Advanced tools
@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.
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));
The `geojson-rewind` package provides similar functionality to @mapbox/geojson-rewind by reorienting the winding order of GeoJSON polygons. It is a lightweight alternative and can be used in similar scenarios where ensuring the correct winding order is necessary.
The GeoJSON specification is picky about winding order.
This helps you generate compliant Polygon and MultiPolygon geometries. Furthermore it lets you use Canvas and other drawing libraries's default behavior to color the interior rings of Polygon and MultiPolygon features.
As NPM module:
npm install --save @mapbox/geojson-rewind
As a console utility:
# install
npm install -g @mapbox/geojson-rewind
# use
geojson-rewind foo.geojson
As a browser library: geojson-rewind.js
rewind(geojson, clockwise)
Given a GeoJSON FeatureCollection, Feature, or Geometry, return a version with inner and outer rings of different winding orders.
If clockwise
is true
, the outer ring is clockwise, otherwise
it is counterclockwise.
FAQs
enforce winding order for geojson
We found that @mapbox/geojson-rewind demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 14 open source maintainers collaborating on the project.
Did you know?
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.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.