描述
将 WGS84 GeoJSON 对象转换为 Mercator (EPSG:3857) 投影
参数
| Name | Type | Description |
|---|---|---|
| geojson | GeoJSON | Position | WGS84 GeoJSON 对象 |
| options? | Object | 可选参数 (默认 {}) |
| options.mutate? | boolean | 允许 GeoJSON 输入被修改(如果为 true 则性能显著提升) (默认 false) |
返回值
GeoJSON 投影后的 GeoJSON
示例
javascript
var pt = turf.point([-71, 41]);
var converted = turf.toMercator(pt);安装
javascript
$ npm install @turf/projection
import { toMercator } from "@turf/projection";
const result = toMercator(...);javascript
$ npm install @turf/turf
import * as turf from "@turf/turf";
const result = turf.toMercator(...);