Product
Socket Now Supports uv.lock Files
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
@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
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 0 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.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.