Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@turf/bbox-polygon
Advanced tools
@turf/bbox-polygon is a module from the Turf.js library that allows you to create a Polygon feature from a bounding box (bbox). This is useful for geographic data manipulation and visualization, especially when you need to represent an area defined by a bounding box as a polygon.
Create Polygon from Bounding Box
This feature allows you to create a Polygon feature from a bounding box. The bounding box is defined by an array of four numbers: [minX, minY, maxX, maxY]. The resulting polygon can be used in various geospatial analyses and visualizations.
const turf = require('@turf/bbox-polygon');
const bbox = [0, 0, 10, 10];
const polygon = turf(bbox);
console.log(JSON.stringify(polygon));
The geojson-bbox package provides functionality to calculate the bounding box of a GeoJSON object. While it focuses on calculating the bbox from existing GeoJSON data, it does not create polygons from bboxes like @turf/bbox-polygon.
The bbox package is a lightweight utility for working with bounding boxes. It provides methods to create, manipulate, and query bounding boxes, but it does not offer the capability to convert a bbox directly into a polygon as @turf/bbox-polygon does.
The geojson-utils package offers a variety of utilities for working with GeoJSON data, including calculating bounding boxes and other spatial operations. However, it does not specifically focus on converting bboxes to polygons like @turf/bbox-polygon.
Takes a bbox and returns an equivalent polygon.
bbox
BBox extent in [minX, minY, maxX, maxY] order
options
Object Optional parameters (optional, default {}
)
var bbox = [0, 0, 10, 10];
var poly = turf.bboxPolygon(bbox);
//addToMap
var addToMap = [poly]
Returns Feature<Polygon> a Polygon representation of the bounding box
This module is part of the Turfjs project, an open source module collection dedicated to geographic algorithms. It is maintained in the Turfjs/turf repository, where you can create PRs and issues.
Install this single module individually:
$ npm install @turf/bbox-polygon
Or install the all-encompassing @turf/turf module that includes all modules as functions:
$ npm install @turf/turf
FAQs
turf bbox-polygon module
The npm package @turf/bbox-polygon receives a total of 779,754 weekly downloads. As such, @turf/bbox-polygon popularity was classified as popular.
We found that @turf/bbox-polygon demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 9 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.