本文整理匯總了TypeScript中@turf/turf.buffer函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript buffer函數的具體用法?TypeScript buffer怎麽用?TypeScript buffer使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了buffer函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1:
// -- Test pointOnSurface --
turf.pointOnSurface(polygon1)
// -- Test square --
turf.square(bbox)
///////////////////////////////////////////
// Tests Transformation
///////////////////////////////////////////
// -- Test bezier --
turf.bezier(lineString1)
// -- Test buffer --
turf.buffer(point1, 50)
turf.buffer(point1, 50, 'miles')
// -- Test concave --
turf.concave(points, 1, 'miles')
// -- Test convex --
turf.convex(points)
// -- Test difference --
turf.difference(polygon1, polygon2)
// -- Test intersect --
turf.intersect(polygon1, polygon2)
turf.intersect(point1, polygon1)
turf.intersect(point1, point1)
示例2: require
import * as turf from '@turf/turf'
import * as path from 'path'
import * as fs from 'fs'
const features = require(path.join(__dirname, 'starbucks.json'))
const buffer = turf.buffer(features, 250, 'meters')
fs.writeFileSync(path.join(__dirname, 'starbucks-buffer.json'), JSON.stringify(buffer, null, 4))
示例3: require
import * as concaveman from 'concaveman'
import * as helpers from 'geojson-helpers'
import * as turf from '@turf/turf'
const data = './halifax-buildings.json'
const geojson: GeoJSON.FeatureCollection<any> = require(data)
const points: Array<Array<number>> = []
geojson.features.map(feature => {
turf.explode(feature).features.map(point => {
points.push(point.geometry.coordinates)
})
})
const extent = turf.polygon([concaveman(points)])
const buffer = turf.buffer(extent, 500, 'meters')
const simple: any = turf.simplify(buffer, 0.001, false)
helpers.writeFileSync('./extent.geojson', turf.featureCollection([extent]))
helpers.writeFileSync('./buffer.geojson', turf.featureCollection([buffer]))
helpers.writeFileSync('./simple.geojson', turf.featureCollection([simple]))