javascript - issues with changing color of google map api markers -
i've looked @ suggestions asked questions similar mine, following google maps api developers info page on overlays, no answers have helped - i'm trying change color of markers standard green, every time try , add fillcolor, etc. code either won't show marker or won't show map @ all. have idea i'm doing wrong?
function createmap() { // map options var options = { zoom: 4, center: new google.maps.latlng(39.909736, -98.522109), // centered maptypeid: google.maps.maptypeid.roadmap, maptypecontrol: false }; // init map map = new google.maps.map(document.getelementbyid('map_canvas'), options); } function addmarker() { fetchnewquote(); var indext; (indext = 0; indext <array.length; ++indext) { splitarr = array[indext].split(":"); geosplit = splitarr[1].split(", "); if (indext < 50) { $('#tweet_table').append(array[indext] + "</br></br>"); } var marker = new google.maps.marker({ position: new google.maps.latlng(geosplit[0], geosplit[1]), map: map, title: 'click me see individual tweeted!' }); (function(marker, splitarr, indext) { var tweetclick = "tobacco visualization</br>" + "keyword: " + splitarr[0] + "</br> coordinates: " + splitarr[1] + "</br> tweet: " + splitarr[2]; google.maps.event.addlistener(marker, 'click', function() { infowindow = new google.maps.infowindow({ content: tweetclick }); infowindow.open(map, marker); }); })(marker, splitarr, indext); marker.setmap(map); markersarray.push(marker); } }
you can load own marker :
var icon = https://chart.googleapis.com/chart?chst=d_map_pin_letter&chld=%e2%80%a2|00ff00
you have pass color of marker @ rgb format after pipe. if want blue marker, pass 0000ff instead of 00ff00.
then, use :
var marker = new google.maps.marker({ position: new google.maps.latlng(geosplit[0], geosplit[1]), map: map, title: 'click me see individual tweeted!' icon: icon });
hope helps !
Comments
Post a Comment