Skip to main content
Version: 6.5.0

randomPosition

Description

Returns a random position within a bounding box.

Parameters

NameTypeDescription
bbox?Array<number>a bounding box inside of which positions are placed. (default [-180,-90,180,90])

Returns

    Array<number> Position [longitude, latitude]

Examples

var position = turf.randomPosition([-180, -90, 180, 90]);
// => position

Installation

$ npm install @turf/random

import { randomPosition } from "@turf/random";
const result = randomPosition(...);
$ npm install @turf/turf

import * as turf from "@turf/turf";
const result = turf.randomPosition(...);