使用turf中randomPoint生成随机点(注意:坐标位置中生成随机坐标)
1.参数
- 随机点数量
- 随机数范围
2.使用
const heatCount = 500
const rectangle = { xmin: 112.592529, xmax: 112.594819, ymax: 35.467768, ymin: 35.46488 }
const arrPoint = turf.randomPoint(heatCount, {
bbox: [rectangle.xmin, rectangle.ymin, rectangle.xmax, rectangle.ymax],
})
3.预览
features 就是得到的随机点
注意:rectangle这个随机数范围取得是斜对角的坐标!!!