Appearance
KBE3D / KBCore / turf / hexGrid
函数: hexGrid()
hexGrid<
P>(bbox:BBox,cellSide:number,options?: {units?:Units;triangles?:boolean;properties?:P;mask?:Feature<Polygon|MultiPolygon,GeoJsonProperties>; }):FeatureCollection<Polygon,P>
Function
Takes a bounding box and the diameter of the cell and returns a FeatureCollection of flat-topped hexagons or triangles (Polygon features) aligned in an "odd-q" vertical grid as described in Hexagonal Grids.
类型参数
P
P extends GeoJsonProperties = GeoJsonProperties
参数
bbox
extent in [minX, minY, maxX, maxY] order
cellSide
number
length of the side of the the hexagons or triangles, in units. It will also coincide with the radius of the circumcircle of the hexagons.
options?
Optional parameters
units?
used in calculating cell size. Supports all valid Turf Units.
triangles?
boolean
whether to return as triangles instead of hexagons
properties?
P
passed to each hexagon or triangle of the grid
mask?
Feature<Polygon | MultiPolygon, GeoJsonProperties>
if passed a Polygon or MultiPolygon, the grid Points will be created only inside it
返回
a hexagonal grid
示例
ts
var bbox = [-96,31,-84,40];
var cellSide = 50;
var options = {units: 'miles'};
var hexgrid = turf.hexGrid(bbox, cellSide, options);
//addToMap
var addToMap = [hexgrid];