simplify
是一个Turf中的转换函数,用于减少GeoJSON要素中的顶点数量。
geojson
(Feature<\LineString>|Feature<\MultiLineString>|Feature<\Polygon>|Feature<\MultiPolygon>|FeatureCollection<\LineString>|FeatureCollection<\MultiLineString>|FeatureCollection<\Polygon>|FeatureCollection<\MultiPolygon>):输入的GeoJSON要素。必填参数。options
(Object?):可选的配置参数对象。
tolerance
(Number?):抽稀容差值。默认为1
。var geojson = {
"type": "Feature",
"geometry": {
"type": "LineString",
"coordinates": [
[-122.03472661972076, 37.42168115996257],
[-122.0304708480835, 37.42247172824014],
[-122.03019475936889, 37.42094015591943],
[-122.02776622772217, 37.41877534278921],
[-122.02466845512378, 37.41548487619012],
[-122.02313399314878, 37.41390114391681]
]
},
"properties": {}
};
var simplified = turf.simplify(geojson);