Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@turf/point-grid
Advanced tools
@turf/point-grid is a module from the Turf.js library that allows you to create a grid of points within a bounding box. This can be useful for various geospatial analyses, such as sampling, spatial interpolation, and creating heatmaps.
Create a Point Grid
This feature allows you to create a grid of points within a specified bounding box. The `bbox` parameter defines the bounding box, `cellSide` specifies the distance between points, and `options` can include units of measurement.
const turf = require('@turf/turf');
const bbox = [-96, 31, -84, 40];
const cellSide = 50;
const options = { units: 'miles' };
const pointGrid = turf.pointGrid(bbox, cellSide, options);
console.log(pointGrid);
Leaflet is a popular open-source JavaScript library for mobile-friendly interactive maps. While it does not directly provide point grid functionality, it can be used in conjunction with other libraries to achieve similar results. Leaflet is more focused on rendering and interacting with maps rather than generating geospatial data.
D3-geo is a module of the D3.js library that provides geographic projections, shapes, and utilities. It can be used to create point grids, but it requires more manual setup compared to @turf/point-grid. D3-geo is more flexible and can be used for a wider range of geospatial visualizations.
Geotiff is a library for reading and writing GeoTIFF files in JavaScript. While it does not directly create point grids, it can be used to manipulate geospatial raster data, which can then be sampled to create point grids. It is more specialized for working with raster data compared to @turf/point-grid.
Creates a grid of points
bbox
BBox extent of grid in [minX, minY, maxX, maxY] order
cellSide
number the distance between points
options
Object Optional parameters (optional, default {}
)
options.units
Units the units of the cellSide value. Supports all valid Turf Units (optional, default 'kilometers'
)options.mask
Feature<(Polygon | MultiPolygon)>? if passed a Polygon or MultiPolygon, the grid Points will be created only inside itoptions.properties
Object passed to each point of the grid (optional, default {}
)var extent = [-70.823364, -33.553984, -70.473175, -33.302986];
var cellSide = 3;
var options = {units: 'miles'};
var grid = turf.pointGrid(extent, cellSide, options);
//addToMap
var addToMap = [grid];
Returns FeatureCollection<Point> grid of points
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/point-grid
Or install the all-encompassing @turf/turf module that includes all modules as functions:
$ npm install @turf/turf
FAQs
turf point-grid module
The npm package @turf/point-grid receives a total of 791,974 weekly downloads. As such, @turf/point-grid popularity was classified as popular.
We found that @turf/point-grid 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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.