Appearance
KBE3D / KBCore / turf / findPoint
函数: findPoint()
findPoint<
G,P>(geojson:G|Feature<G,P> |FeatureCollection<G,P>,options?: {featureIndex?:number;multiFeatureIndex?:number;geometryIndex?:number;coordIndex?:number;properties?:P;bbox?:BBox;id?:Id; }):Feature<Point,P>
Finds a particular Point from a GeoJSON using @turf/meta indexes.
Negative indexes are permitted.
类型参数
G
G extends Geometry
P
P extends GeoJsonProperties = GeoJsonProperties
参数
geojson
Any GeoJSON Feature or Geometry
G | Feature<G, P> | FeatureCollection<G, P>
options?
Optional parameters
featureIndex?
number
Feature Index
multiFeatureIndex?
number
Multi-Feature Index
geometryIndex?
number
Geometry Index
coordIndex?
number
Coord Index
properties?
P
Translate Properties to output Point
bbox?
Translate BBox to output Point
id?
Translate Id to output Point
返回
2-vertex GeoJSON Feature Point
示例
ts
var multiLine = turf.multiLineString([
[[10, 10], [50, 30], [30, 40]],
[[-10, -10], [-50, -30], [-30, -40]]
]);
// First Segment (defaults are 0)
turf.findPoint(multiLine);
// => Feature<Point<[10, 10]>>
// First Segment of the 2nd Multi-Feature
turf.findPoint(multiLine, {multiFeatureIndex: 1});
// => Feature<Point<[-10, -10]>>
// Last Segment of last Multi-Feature
turf.findPoint(multiLine, {multiFeatureIndex: -1, coordIndex: -1});
// => Feature<Point<[-30, -40]>>