javascript - Direction arrow does not show, but polyline is showing in google map -
i trying draw direction arrows poly line. code not show arrows plots every markers info windows , poly line using data set. want add arrows this. http://jsfiddle.net/nx8u8/2/ here code .done function of ajax callback.
can explain me wrong done.
var path1 = []; var poliline;
function getdata(){ $.ajax({ url: '/filter', datatype:'json', type: 'post', data: {'mmsi':$('input[name=mmsi]').val(),'from': $("input[name='from']").val(), 'to': $("input[name='to']").val()} }).done(function(data) { initmap(); console.log(data.length); console.log(data); $.each(data, function(index, obj){ console.log( obj.latitude + " - " +obj.longitude ); //console.log("helloooo"); var pos = {lat: obj.latitude, lng: obj.longitude}; path1.push({lat: parsefloat(obj.latitude), lng: parsefloat(obj.longitude)}); contentstring = "<p>" +obj.last_received_date+ "<br>"+obj.last_received_time+"</p>"; var infowindow = new google.maps.infowindow({ content: contentstring }); var circleicon = { path: google.maps.symbolpath.circle, fillcolor: '#600d48', fillopacity: 0.8, scale: 2, strokecolor: '#600d48' }; var pathmarker = new google.maps.marker({ position: pos, icon: circleicon, map: map }); pathmarker.addlistener('mouseover', function() { infowindow.open(map, pathmarker); }); // assuming want hide infowindow when user mouses-out pathmarker.addlistener('mouseout', function() { infowindow.close(); }); }); var linesymbol = { path: google.maps.symbolpath.forward_closed_arrow }; var polylineoptns = { strokeopacity: 0.8, strokeweight: 3, path: path1, strokecolor: '#ff0000', strokeopacity: 1.0, map: map, icons: [{ icon: linesymbol, repeat: '70px', offset: '100%' }], }; polyline = new google.maps.polyline(polylineoptns); path1 = []; }).always(function() { }).fail(function(jqxhr, textstatus, errorthrown) { alert('error: ' + errorthrown); }) }
Comments
Post a Comment