javascript - Bulk uploading markers from Excel with custom info boxes -


i'm trying upload excel spreadsheet containing student names geolocations, , "top skills" online class google javascript api.

eventually, want each location have popup box associated it, displaying student name , top skills.

from can tell according api, have use data arrays plot markers:

var locations = [   ['bondi beach', -33.890542, 151.274856, 4],   ['coogee beach', -33.923036, 151.259052, 5],   ['cronulla beach', -34.028249, 151.157507, 3],   ['manly beach', -33.80010128657071, 151.28747820854187, 2],   ['maroubra beach', -33.950198, 151.259302, 1] ]; 

then add these locations this:

for (i = 0; < locations.length; i++) {         marker = new google.maps.marker({         position: new google.maps.latlng(locations[i][1], locations[i][2]),         map: map       });     } 

a couple of questions:

  1. is there speedier way of uploading excel spreadsheet data javascript format without manually writing each location?
  2. how associate specific locations student name , list of skills?

you use json this. if save excel file .csv there online converters can change json. in past i've done on project:

http://burdsgis.coffeecup.com/blueplaques/bpwords.html

the json above looks this:

var dec_markers = [  {     "newnumber": "1",     "title": "97",     "location": "unknown",     "unveiler": "unknown",     "date": "unknown",     "sponsor": "unknown",     "tomeast": "-1.55167",     "tomnorth": "53.7917",     "title2": "97",     "tomurl": "http://farm1.staticflickr.com/76/198148805_85d6ff5b44_m.jpg",     "tomlink": "http://www.flickr.com/photos/44067831@n00/198148805/in/set-1439239/" }, 

etc...

you can call json in map.js:

        //for loop run through marker data     (id in dec_markers) {          var photo = '<a href="' + dec_markers[id].tomlink + '" target="_blank" title="' + dec_markers[id].title +' tom.smith, on flickr"><img src="' + dec_markers[id].tomurl + '" alt="' + dec_markers[id].title2 + '"></a>';          var info =  '<div><h1>' + dec_markers[id].title + '</h1><p><b>date unveiled: </b>'  + dec_markers[id].date + "<br><b>sponsor: </b>" + dec_markers[id].sponsor + '</p>' + photo + '</div>';          var latlng = new google.maps.latlng(dec_markers[id].tomnorth,dec_markers[id].tomeast);          addmarker(latlng,dec_markers[id].title,info);          mc.addmarker(marker);         } 

i scraping images flickr album populate pop boxes (using flickr api).

google csv json converter. i'd suggest using infobubble rather infowindow former more versatile. clustering effect can use markerclustererplus google maps v3


Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -