Security News
CISA Brings KEV Data to GitHub
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.
generate-random-points
Advanced tools
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release) [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?
Generates random geolocation objects, in the form of plain-old javascript objects.
Install it with npm
or yarn
and use as a normal module
$ npm install generate-random-points --save
Consider this code:
'use strict'
const {
generateRandomPoint,
generateRandomPoints
} = require('generate-random-points')
const options = {
centerPosition: {
lat: 24.23,
lng: 23.12
},
radius: 1000,
count: 2
}
let listOfPoints = generateRandomPoints(options.centerPosition, options.radius, options.count)
let singlePoint = generateRandomPoint(options.centerPosition, options.radius)
return {
listOfPoints,
singlePoint
}
It should produce something like this:
{
"listOfPoints": [
{
"latitude": 24.229716908541928,
"longitude": 23.11553173995286
},
{
"latitude": 24.234458720495013,
"longitude": 23.10966586687313
}
],
"singlePoint": {
"latitude": 24.232510757349,
"longitude": 23.12242028161285
}
}
/**
* Generates number of random geolocation points given a center and a radius.
*
* @param {Object} center A JS object with lat and lng attributes.
* @param {number} radius Radius in meters.
* @param {number} count Number of points to generate.
* @return {array} Array of Objects with lat and lng attributes.
*/
/**
* Generates number of random geolocation points given a center and a radius.
*
* Reference URL: http://goo.gl/KWcPE.
* @param {Object} center A JS object with 'latitude' and 'longitude' attributes.
* @param {number} radius Radius in meters.
* @return {Object} The generated random points as JS object with latitude and longitude attributes.
*/
All those involved in this stackoverflow page: http://goo.gl/KWcPE @mkhatib for publishing this snippet of code in this gist https://gist.github.com/mkhatib/5641004
FAQs
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release) [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?
We found that generate-random-points demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.
Security News
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.