Skip to main content
Version: 7.2.0

isolines

描述

¥Description

获取一个包含 个特性、z 值和一个值分隔数组的网格 FeatureCollection,并生成 isolines

¥Takes a grid FeatureCollection of Point features with z-values and an array of value breaks and generates isolines.

参数

¥Parameters

名称类型描述
pointGridFeatureCollection<>输入点
breaks数组<number>zProperty 的值用于指定绘制等值线的位置
options?对象可选参数(默认 {})
options.zProperty?stringpoints 中用于提取 z 值的属性名称(默认值为 'elevation')
options.commonProperties?对象传递给所有等值线的 GeoJSON 属性(默认 {})
options.breaksProperties?数组<对象>按顺序将 GeoJSON 属性传递给相应的等值线;breaks 数组将定义等值线的创建顺序(默认为 [])

返回

¥Returns

FeatureCollection<MultiLineString> 表示等值线的 MultiLineString 特性的 FeatureCollection 等值线

¥FeatureCollection<MultiLineString> a FeatureCollection of MultiLineString features representing isolines

示例

¥Examples

// create a grid of points with random z-values in their properties
var extent = [0, 30, 20, 50];
var cellWidth = 100;
var pointGrid = turf.pointGrid(extent, cellWidth, { units: "miles" });

for (var i = 0; i < pointGrid.features.length; i++) {
pointGrid.features[i].properties.temperature = Math.random() * 10;
}
var breaks = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];

var lines = turf.isolines(pointGrid, breaks, { zProperty: "temperature" });

安装

¥Installation

$ npm install @turf/isolines

import { isolines } from "@turf/isolines";
const result = isolines(...);
$ npm install @turf/turf

import * as turf from "@turf/turf";
const result = turf.isolines(...);