-
-
Save murindwaz/6190858 to your computer and use it in GitHub Desktop.
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
var mysql = require('mysql'); | |
var randy = require('randy'); | |
var _ = require('underscore'); | |
// Query base. | |
var sql = 'INSERT INTO omeka_neatline_records (' + | |
'exhibit_id,'+ | |
'title,'+ | |
'description,'+ | |
'map_active,'+ | |
'vector_color,'+ | |
'stroke_color,'+ | |
'select_color,'+ | |
'point_radius,'+ | |
'stroke_opacity,'+ | |
'graphic_opacity,'+ | |
'vector_opacity,'+ | |
'select_opacity,'+ | |
'stroke_width,'+ | |
'min_zoom,'+ | |
'max_zoom,'+ | |
'coverage'+ | |
') VALUES'; | |
// Create records. | |
_(count).times(function(n) { | |
// Get random point coordinates and radius. | |
var lat = randy.randInt(-20000000,20000000); | |
var lon = randy.randInt(-20000000,20000000); | |
var geo = 'GeomFromText("POINT('+lon+' '+lat+')")'; | |
var rad = randy.randInt(10,100); | |
// Values. | |
sql += '(' + | |
exhibit_id+','+ | |
'"Record'+n+'",'+ | |
'"Description'+n+'",'+ | |
'1,'+ | |
'"'+color+'",'+ | |
'"#000000",'+ | |
'"'+color+'",'+ | |
rad+','+ | |
100+','+ | |
100+','+ | |
30+','+ | |
50+','+ | |
2+','+ | |
zoom+','+ | |
zoom+','+ | |
geo+ | |
')'; | |
// Comma, except for last. | |
if (n != count-1) sql += ','; | |
}); | |
client.query(sql); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment