javascript - different colors for different routes on google maps importing multiple KML files build in google engine? -
i loading multiple kml layers files google maps. becomes difficult read since different bus routes on map. possible have them in different colors example kml1 file in red , kml2 file in blue etc. used google engine build these kml files did not option use different colors on line/markers.
function initialize() { var abby = new google.maps.latlng(49.051078,-122.314221); var mapoptions = { zoom: 11, center: abby } map = new google.maps.map(document.getelementbyid('map-canvas'), mapoptions); var ctalayer = new google.maps.kmllayer({ url:'https://dl.dropboxusercontent.com/u/143598220/1.%20blueridge-mckee%20goline.kml' }); var ctalayer2 = new google.maps.kmllayer({ url:'https://dl.dropboxusercontent.com/u/143598220/2.%20bluejay-huntingdon%20goline.kml' }); var ctalayer3 = new google.maps.kmllayer({ url:'https://dl.dropboxusercontent.com/u/143598220/3.%20clearbrook%20-%20ufv%20goline.kml' }); ctalayer.setmap(map); ctalayer2.setmap(map); ctalayer3.setmap(map); if(navigator.geolocation) { navigator.geolocation.getcurrentposition(function(position) { var pos = new google.maps.latlng(position.coords.latitude, position.coords.longitude); var infowindow = new google.maps.infowindow({ map: map, position: pos, disableautopan: true }); marker=new google.maps.marker({ position:pos, animation:google.maps.animation.bounce, disableautopan: true }); marker.setmap(map); var infowindow2 = new google.maps.infowindow({ content:"your current location!" }); google.maps.event.addlistener(marker, 'click', function() { infowindow2.open(map,marker); }); // map.setcenter(pos); }, function() { handlenogeolocation(true); }); } else { // browser doesn't support geolocation handlenogeolocation(false); } } function handlenogeolocation(errorflag) { if (errorflag) { var content = 'error: geolocation service failed.'; } else { var content = 'error: browser doesn\'t support geolocation.'; } var options = { map: map, position: new google.maps.latlng(60, 105), content: content }; var infowindow = new google.maps.infowindow(options); map.setcenter(options.position); } google.maps.event.adddomlistener(window, 'load', initialize);
Comments
Post a Comment