Appearance
函数: bbox()
bbox(
geojson:AllGeoJSON,options?: {recompute?:boolean; }):BBox
Function
Calculates the bounding box for any GeoJSON object, including FeatureCollection. Uses geojson.bbox if available and options.recompute is not set.
参数
geojson
any GeoJSON object
options?
Optional parameters
recompute?
boolean
Whether to ignore an existing bbox property on geojson
返回
bbox extent in [minX, minY, maxX, maxY] order
示例
ts
var line = turf.lineString([[-74, 40], [-78, 42], [-82, 35]]);
var bbox = turf.bbox(line);
var bboxPolygon = turf.bboxPolygon(bbox);
//addToMap
var addToMap = [line, bboxPolygon]