random_randomPosition
Generate random geographic coordinates within a specified bounding box or globally. Returns longitude and latitude values for mapping, testing, or simulation purposes.
Instructions
生成随机的地理坐标位置。
此功能在指定的边界框内随机生成一个地理坐标位置,返回经度和纬度坐标。
Args: bbox: 边界框数组 - 类型: str (JSON 字符串格式的数组) 或 None - 格式: [minX, minY, maxX, maxY] - 默认: [-180, -90, 180, 90] (全球范围) - 示例: '[-180, -90, 180, 90]'
Returns: str: JSON 字符串格式的坐标位置数组 - 类型: 数组 [经度, 纬度] - 格式: [lng, lat] - 示例: '[-75.343, 39.984]'
Raises: Exception: 当 JavaScript 执行失败、超时或输入数据格式错误时抛出异常
Example: >>> import asyncio >>> bbox = '[-180, -90, 180, 90]' >>> result = asyncio.run(randomPosition(bbox)) >>> print(result) '[-75.343, 39.984]'
Notes: - 输入参数 bbox 必须是有效的 JSON 字符串或 None - 坐标顺序为 [经度, 纬度] (WGS84 坐标系) - 如果未指定边界框,默认在全球范围内生成随机位置 - 依赖于 Turf.js 库和 Node.js 环境
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bbox | No |