当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript helpers.polygon函数代码示例

本文整理汇总了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;未经允许,请勿转载。