Created
May 18, 2016 12:02
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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