本文整理汇总了TypeScript中@turf/helpers.lineString函数的典型用法代码示例。如果您正苦于以下问题:TypeScript lineString函数的具体用法?TypeScript lineString怎么用?TypeScript lineString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了lineString函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: point
import {
point, lineString, polygon,
multiPoint, multiLineString, multiPolygon,
featureCollection, geometryCollection
} from '@turf/helpers'
import buffer from './'
// Standard Geometry
const pt = point([100, 0]);
const line = lineString([[100, 0], [50, 0]]);
const poly = polygon([[[100, 0], [50, 0], [0, 50], [100, 0]]]);
buffer(pt, 5);
buffer(line, 5);
buffer(poly, 5);
buffer(pt, 5, {units: 'miles'});
buffer(pt, 10, {units: 'meters', steps: 64});
// Multi Geometry
const multiPt = multiPoint([[100, 0], [0, 100]]);
const multiLine = multiLineString([[[100, 0], [50, 0]], [[100, 0], [50, 0]]]);
const multiPoly = multiPolygon([[[[100, 0], [50, 0], [0, 50], [100, 0]]], [[[100, 0], [50, 0], [0, 50], [100, 0]]]]);
buffer(multiPt, 5);
buffer(multiLine, 5);
buffer(multiPoly, 5);
// Collections
const fc = featureCollection([pt, line]);
const gc = geometryCollection([pt.geometry, line.geometry]);
开发者ID:OlympicsORG,项目名称:turf,代码行数:30,代码来源:types.ts
示例2: lineString
import {lineString} from '@turf/helpers'
import centroid from './'
const line = lineString([[0, 0], [10, 10]]);
centroid(line)
centroid(line, {foo: 'bar'})
开发者ID:OlympicsORG,项目名称:turf,代码行数:7,代码来源:types.ts
示例3: point
featureReduce,
featureEach,
coordAll,
geomReduce,
geomEach,
flattenReduce,
flattenEach,
segmentReduce,
segmentEach,
lineReduce,
lineEach
} from './'
// Fixtures
const pt = helpers.point([0, 0])
const line = helpers.lineString([[0, 0], [1, 1]])
const poly = helpers.polygon([[[0, 0], [1, 1], [0, 1], [0, 0]]])
const multiPoly = helpers.multiPolygon([[[[0, 0], [1, 1], [0, 1], [0, 0]]]])
const multiLine = helpers.multiLineString([[[0, 0], [1, 1], [0, 1], [0, 0]], [[2, 2], [3, 3]]])
const geomCollection = helpers.geometryCollection([pt.geometry, line.geometry])
const features = helpers.featureCollection<Point|LineString>([pt, line])
const customPoint = point([10, 20], {foo: 'abc', bar: 123})
const customPoints = featureCollection([customPoint])
const customLineString = lineString([[0, 0], [10, 20]], {foo: 'abc', bar: 123})
const customLineStrings = featureCollection([customLineString])
/**
* meta.coordEach
*/
const coordEachValue: void = meta.coordEach(pt, coords => coords)
开发者ID:Turbo87,项目名称:turf,代码行数:31,代码来源:types.ts
示例4: lineString
import {featureCollection, lineString, multiLineString, Polygon, MultiPolygon} from '@turf/helpers'
import * as polygonToLineString from '../'
// Fixtures
const coords = [[125, -30], [145, -30], [145, -20], [125, -20], [125, -30]];
const line = lineString(coords);
const multiLine = multiLineString([coords, coords]);
// Assert results with types
const poly1: Polygon = polygonToLineString(line);
const poly2: Polygon = polygonToLineString(multiLine);
const multiPoly: MultiPolygon = polygonToLineString(featureCollection([line, multiLine]));
开发者ID:dpmcmlxxvi,项目名称:turf,代码行数:12,代码来源:types.ts
示例5:
import {
Geometry,
Types,
GeometryCollection,
Point,
LineString,
Polygon,
GeometryTypes,
Position
} from '@turf/helpers'
/**
* Fixtures
*/
const pt = helpers.point([0, 0])
const line = helpers.lineString([[0, 0], [1, 1]])
const poly = helpers.polygon([[[0, 0], [1, 1], [2, 2], [0, 0]]])
const gc = helpers.geometryCollection([pt.geometry, line.geometry, poly.geometry])
const fc = helpers.featureCollection([pt, line, poly])
/**
* invariant.getGeom
*/
// invariant.getGeom(fc) // Argument of type 'FeatureCollection<any>' is not assignable to parameter of type
invariant.getGeom(gc)
// const gcGeom: GeometryCollection = invariant.getGeom(gc) // => NOT SUPPORTED
const pointGeom: Point = invariant.getGeom(pt)
const lineGeom: LineString = invariant.getGeom(line)
const polyGeom: Polygon = invariant.getGeom(poly)
invariant.getGeom(pt.geometry)
开发者ID:OlympicsORG,项目名称:turf,代码行数:30,代码来源:types.ts
注:本文中的@turf/helpers.lineString函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论