Skip to content

Instantly share code, notes, and snippets.

@cristiandley
Created May 18, 2016 12:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cristiandley/8e1794b7f414c82a693a2720acf78b1f to your computer and use it in GitHub Desktop.
Save cristiandley/8e1794b7f414c82a693a2720acf78b1f to your computer and use it in GitHub Desktop.
Generate Coordinates, you should change the -68 -38 and min max of your coordinates city
function pad (str, max) {
str = str.toString();
return str.length < max ? pad("0" + str, max) : str;
}
function rand(min,max)
{
return Math.floor(Math.random()*(max-min+1)+min);
}
var arr = []
for (var i = 0; i < 1500; i++) {
arr.push(
{
id: i,
coord: {
lat: parseFloat("-38."+pad(rand(9365,9691),4)),
lng: parseFloat("-68."+pad(rand(342,1185),4))
},
tipo: ["secuestro","hurto","estafa","asesinato"][rand(0,3)]
}
)
}
console.log(arr)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment