# transformScale
Scale a GeoJSON from a given point by a factor of scaling (ex: factor=2 would make the GeoJSON 200% larger). If a FeatureCollection is provided, the origin point will be calculated based on each individual Feature.
从一个给定的点缩放GeoJSON(例如:factor=2将使GeoJSON增大200%)。如果提供了FeatureCollection
,则将根据每个单独的Feature
计算原点。
参数
参数 | 类型 | 描述 |
---|---|---|
geojson | GeoJSON | GeoJSON to be scaled |
factor | number | of scaling, positive or negative values greater than 0 |
options | Object | 可选参数:见下文 |
options选项
属性 | 类型 | 默认值 | 描述 |
---|---|---|---|
origin | (string | Coord) | centroid |
mutate | boolean | false | 允许修改GeoJSON输入(如果为真,性能将显著提高) |
返回
GeoJSON - scaled GeoJSON
示例
// 注意:polygon首尾坐标要一致
var poly = turf.polygon([[[0,29],[3.5,29],[2.5,32],[0,29]]]);
var scaledPoly = turf.transformScale(poly, 3);