答案 0 :(得分:2)
感谢@iant,我已经能够使用turf生成边界框(实际上是多边形)。这是我使用的代码:
turf = require("turf")
var line = turf.lineString([
[-122.1381719, 37.4687134],
[-122.0300914, 37.331695]
]);
var unit = 'miles';
var buffered = turf.buffer(line, 5, unit);
var tolerance = 0.03; // increase tolerance to reduce polygon segments
var simplified = turf.simplify(buffered, tolerance, false);