• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript helpers.polygon函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中@turf/helpers.polygon函数的典型用法代码示例。如果您正苦于以下问题:TypeScript polygon函数的具体用法?TypeScript polygon怎么用?TypeScript polygon使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了polygon函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: point

import { polygon, point, featureCollection, geometryCollection, Feature, Polygon, FeatureCollection } from '@turf/helpers';
import rotate from './'

const pt = point([15, 15]);
const poly = polygon([[[0,29],[3.5,29],[2.5,32],[0,29]]]);

// Does not mutate Geometry type
const rotatedPoly: Feature<Polygon> = rotate(poly, 100, {pivot: pt});
const rotatedFCPoly: FeatureCollection<Polygon> = rotate(featureCollection([poly]), 100, {pivot: pt});

// Different Geometry Inputs
rotate(poly, 100, {pivot: pt});
rotate(poly, 100, {pivot: pt.geometry});
rotate(poly.geometry, 100, {pivot: pt.geometry.coordinates});
rotate(featureCollection([poly]), 100, {pivot: pt.geometry});
rotate(featureCollection([poly, pt]), 100, {pivot: pt});
rotate(geometryCollection([poly.geometry]).geometry, 100, {pivot: pt.geometry});
rotate(geometryCollection([poly.geometry]), 100, {pivot: pt.geometry});
rotate(geometryCollection([poly.geometry, pt.geometry]), 100, {pivot: pt});

// Allow mutating
rotate(poly, 100, {pivot: pt, mutate: true});
开发者ID:OlympicsORG,项目名称:turf,代码行数:22,代码来源:types.ts


示例2: polygon

import { BBox, polygon, Polygon} from '@turf/helpers';
import pointGrid from './';

const cellSide = 50;
const bbox: BBox = [-95, 30, -85, 40];
const poly = polygon([[[20, 30], [10, 10], [20, 20], [20, 30]]]);

pointGrid(bbox, cellSide);
pointGrid(bbox, cellSide, {units: 'miles'});
pointGrid(bbox, cellSide, {units: 'miles', mask: poly});
pointGrid(bbox, cellSide, {units: 'miles', mask: poly, properties: {foo: 'bar'}});
开发者ID:OlympicsORG,项目名称:turf,代码行数:11,代码来源:types.ts


示例3: polygon

import * as tangents from '../'
import {polygon, point} from '@turf/helpers'

const poly = polygon([[[11, 0], [22, 4], [31, 0], [31, 11], [21, 15], [11, 11], [11, 0]]])
const pt = point([61, 5])
tangents(pt, poly)
开发者ID:dpmcmlxxvi,项目名称:turf,代码行数:6,代码来源:types.ts


示例4: points

import pointsWithinPolygon from './'
import { points, polygon } from '@turf/helpers'

const pts = points([
    [-46.6318, -23.5523],
    [-46.6246, -23.5325],
    [-46.6062, -23.5513],
    [-46.663, -23.554],
    [-46.643, -23.557]
]);
const searchWithin = polygon([[
    [-46.653,-23.543],
    [-46.634,-23.5346],
    [-46.613,-23.543],
    [-46.614,-23.559],
    [-46.631,-23.567],
    [-46.653,-23.560],
    [-46.653,-23.543]
]]);
const ptsWithin = pointsWithinPolygon(pts, searchWithin);
开发者ID:OlympicsORG,项目名称:turf,代码行数:20,代码来源:types.ts


示例5: polygon

import {polygon, lineString, multiLineString, multiPolygon} from '@turf/helpers'
import * as rewind from '../'

const coords = [[121, -29], [138, -29], [138, -18], [121, -18], [121, -29]]
const poly = polygon([coords])
const line = lineString(coords)
const multiPoly = multiPolygon([[coords], [coords]])
const multiLine = multiLineString([coords, coords])

rewind(line)
rewind(poly)
rewind(multiPoly)
rewind(multiLine)
rewind(poly, true)
rewind(poly, true, true)
开发者ID:dpmcmlxxvi,项目名称:turf,代码行数:15,代码来源:types.ts


示例6: point

import {
    point, lineString, polygon,
    multiPoint, multiLineString, multiPolygon,
    featureCollection, geometryCollection} from '@turf/helpers'
import * as meta from './'

const pt = point([0, 0])
const line = lineString([[0, 0], [1, 1]])
const poly = polygon([[[0, 0], [1, 1], [0, 1], [0, 0]]])
const multiPoly = multiPolygon([[[[0, 0], [1, 1], [0, 1], [0, 0]]]])
const geomCollection = geometryCollection([pt.geometry, line.geometry])
const features = featureCollection([pt, line])

// coordEach
meta.coordEach(pt, coords => coords)
meta.coordEach(pt, (coords, index) => coords)
meta.coordEach(pt.geometry, coords => { const equal: number[] = coords })
meta.coordEach(line, coords => { const equal: number[] = coords })
meta.coordEach(poly, coords => { const equal: number[] = coords })
meta.coordEach(multiPoly, coords => { const equal: number[] = coords })
meta.coordEach(geomCollection, coords => coords)

// coordReduce
meta.coordReduce(pt, (previous, coords) => coords)
meta.coordReduce(pt, (previous, coords, index) => coords)
meta.coordReduce(pt, (previous, coords, index) => coords, 0)
meta.coordReduce(pt, (previous, coords) => { const equal: Array<number> = coords })
meta.coordReduce(geomCollection, (previous, coords) => coords)

interface CustomProps {
    foo: string
开发者ID:z0630,项目名称:turf,代码行数:31,代码来源:types.ts


示例7: polygon

import {point, polygon} from '@turf/helpers'
import * as inside from '../'

const poly = polygon([[[0, 0], [0, 100], [100, 100], [100, 0], [0, 0]]]);
const pt = point([50, 50]);
inside(pt, poly);
开发者ID:dpmcmlxxvi,项目名称:turf,代码行数:6,代码来源:types.ts


示例8: point

    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)
coordEach(pt, (coords, index) => coords)
开发者ID:Turbo87,项目名称:turf,代码行数:31,代码来源:types.ts



注:本文中的@turf/helpers.polygon函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript helpers.radiansToDegrees函数代码示例发布时间:2022-05-28
下一篇:
TypeScript helpers.point函数代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap