Appearance
KBE3D / KBCore / turf / flatten
函数: flatten()
调用签名
flatten<
T>(geojson:T|Feature<T,GeoJsonProperties> |FeatureCollection<T,GeoJsonProperties>):FeatureCollection<Point>
Function
Flattens any GeoJSON to a FeatureCollection inspired by geojson-flatten.
类型参数
T
T extends Point | MultiPoint
参数
geojson
any valid GeoJSON Object
T | Feature<T, GeoJsonProperties> | FeatureCollection<T, GeoJsonProperties>
返回
all Multi-Geometries are flattened into single Features
示例
ts
var multiGeometry = turf.multiPolygon([
[[[102.0, 2.0], [103.0, 2.0], [103.0, 3.0], [102.0, 3.0], [102.0, 2.0]]],
[[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]],
[[100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2]]]
]);
var flatten = turf.flatten(multiGeometry);
//addToMap
var addToMap = [flatten]调用签名
flatten<
T>(geojson:T|Feature<T,GeoJsonProperties> |FeatureCollection<T,GeoJsonProperties>):FeatureCollection<LineString>
Function
Flattens any GeoJSON to a FeatureCollection inspired by geojson-flatten.
类型参数
T
T extends LineString | MultiLineString
参数
geojson
any valid GeoJSON Object
T | Feature<T, GeoJsonProperties> | FeatureCollection<T, GeoJsonProperties>
返回
all Multi-Geometries are flattened into single Features
示例
ts
var multiGeometry = turf.multiPolygon([
[[[102.0, 2.0], [103.0, 2.0], [103.0, 3.0], [102.0, 3.0], [102.0, 2.0]]],
[[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]],
[[100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2]]]
]);
var flatten = turf.flatten(multiGeometry);
//addToMap
var addToMap = [flatten]调用签名
flatten<
T>(geojson:T|Feature<T,GeoJsonProperties> |FeatureCollection<T,GeoJsonProperties>):FeatureCollection<Polygon>
Function
Flattens any GeoJSON to a FeatureCollection inspired by geojson-flatten.
类型参数
T
T extends Polygon | MultiPolygon
参数
geojson
any valid GeoJSON Object
T | Feature<T, GeoJsonProperties> | FeatureCollection<T, GeoJsonProperties>
返回
all Multi-Geometries are flattened into single Features
示例
ts
var multiGeometry = turf.multiPolygon([
[[[102.0, 2.0], [103.0, 2.0], [103.0, 3.0], [102.0, 3.0], [102.0, 2.0]]],
[[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]],
[[100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2]]]
]);
var flatten = turf.flatten(multiGeometry);
//addToMap
var addToMap = [flatten]调用签名
flatten(
geojson:AllGeoJSON):FeatureCollection<any>
Function
Flattens any GeoJSON to a FeatureCollection inspired by geojson-flatten.
参数
geojson
any valid GeoJSON Object
返回
FeatureCollection<any>
all Multi-Geometries are flattened into single Features
示例
ts
var multiGeometry = turf.multiPolygon([
[[[102.0, 2.0], [103.0, 2.0], [103.0, 3.0], [102.0, 3.0], [102.0, 2.0]]],
[[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]],
[[100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2]]]
]);
var flatten = turf.flatten(multiGeometry);
//addToMap
var addToMap = [flatten]