unit_conversion_toMercator
Convert geographic coordinates to Mercator projection for web mapping applications. Transforms WGS84 latitude/longitude coordinates into Web Mercator (EPSG:3857) format used by online maps like Google Maps and OpenStreetMap.
Instructions
将地理坐标转换为墨卡托投影坐标。
此功能将WGS84地理坐标转换为Web墨卡托投影坐标(EPSG:3857)。
Args: geojson: GeoJSON对象 - 类型: str (JSON 字符串格式的 GeoJSON) - 格式: 任何有效的 GeoJSON 对象 - 示例: '{"type": "Point", "coordinates": [-75.343, 39.984]}'
Returns: str: JSON 字符串格式的墨卡托投影 GeoJSON - 类型: 相同的 GeoJSON 类型,但坐标为墨卡托投影 - 格式: {"type": "Point", "coordinates": [x, y]} - 示例: '{"type": "Point", "coordinates": [-8385846.33, 4852834.51]}'
Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常
Example: >>> import asyncio >>> geojson = '{"type": "Point", "coordinates": [-75.343, 39.984]}' >>> result = asyncio.run(toMercator(geojson)) >>> print(result) '{"type": "Point", "coordinates": [-8385846.33, 4852834.51]}'
Notes: - 输入坐标必须是WGS84地理坐标(经度/纬度) - 输出坐标为Web墨卡托投影坐标(EPSG:3857) - 常用于Web地图显示(如Google Maps、OpenStreetMap) - 依赖于 Turf.js 库和 Node.js 环境
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| geojson | Yes |