Security News
NVD Backlog Tops 20,000 CVEs Awaiting Analysis as NIST Prepares System Updates
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
@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 Point grid from a bounding box, FeatureCollection or Feature.
Parameters
bbox
(Array<number> | FeatureCollection | Feature<any>) extent in [minX, minY, maxX, maxY] ordercellSide
number the distance between pointsunits
[string] used in calculating cellSide, can be degrees, radians, miles, or kilometers (optional, default kilometers
)centered
[boolean] adjust points position to center the grid into bbox. This parameter is going to be removed in the next major release, having the output always centered into bbox. (optional, default true
)bboxIsMask
[boolean] if true, and bbox is a Polygon or MultiPolygon, the grid Point will be created
only if inside the bbox Polygon(s) (optional, default false
)Examples
var extent = [-70.823364, -33.553984, -70.473175, -33.302986];
var cellSide = 3;
var units = 'miles';
var grid = turf.pointGrid(extent, cellSide, units);
//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 module individually:
$ npm install @turf/point-grid
Or install the Turf module that includes it as a function:
$ npm install @turf/turf
FAQs
turf point-grid module
The npm package @turf/point-grid receives a total of 732,805 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
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.