move image angle direction on google map

move image angle direction on google map

I try this code for plotting data on google map This code is generate table through jquery and plotting data on google map and also on load small content window is display on every marker


success: function (result) {

var d = JSON.parse(result.d).response;

 console.log(JSON.parse(result.d).response);

console.log(JSON.stringify(result.d).response);

$("#tabledata").empty();

 if (d.length > 0) {

 $("#tabledata").append(

  "<thead><tr><th>No</th><th>DateTime</th><th>Status</th<th>Longitude</th><th>Latitude</th</tr></thead>");

 for (var i = 0; i < d.length - 1; i++) {

if (d[i] !== null) {

 $("#tabledata").append("<tbody><tr><td>" +

d[i][0] + "</td> <td>" +

d[i][1] + "</td> <td>" +

d[i][2] + "</td> <td>" +

 d[i][3] + "</td> <td>" +

d[i][4] + "</td><td>" +

d[i][5] + "</td</tr></tbody>");

Status = d[i][2];

No = d[i][0];

 latit = d[i][4];

 longi = d[i][3];

} } }

else {

 $("#tabledata").hide();

}

 alert(d.length);

var map;

var latlng = new google.maps.LatLng(27.0895898, 69.0998546);

var myOptions = {

 zoom: 8,

 center: latlng,

 mapTypeId: google.maps.MapTypeId.ROADMAP

 };

map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);

for (i = 0; i < d.length - 1; i++) {

var data = d[i]

 var myLatlng = new google.maps.LatLng(d[i][4], d[i][3]);

 var marker = new google.maps.Marker({

position: myLatlng,

 icon: "/images/small car.png",

map: map,

 title: 'Click me'

 });

 var infowindow = new google.maps.InfoWindow({

 content: 'No:' + d[i][0] + '<br>Status:' + d[i][2] + '<br>Lat:' + d[i][4] + 'Long:' + d[i][3]

 });

 google.maps.event.addListener(marker, 'mouseclick', function () {

infowindow.open(map, marker,data);

});

 infowindow.open(map, marker,data);

}

now i want to set directions

data in table is

No Status Datetime Longitude Latitude Direction BF 5 2016-09-23 15:08:38.000 65.1197 34.95387 88 BR 5 2016-09-23 15:17:26.000 65.068758 34.8639578 292

now i want to move image according to this direction column i have this code but looks complicated i want to do this through jquery and less lines of code



int angle = Convert.ToInt32(dataTable.Rows[j]["Direction"].ToString());

  img = "target.gif";

 DateTime sdatetime =          

 Convert.ToDateTime(dataTable.Rows[j]["DateTime"].ToString());

 DateTime edatetime = DateTime.Now;

TimeSpan ddiff = edatetime.Subtract(sdatetime);

 int hddiff = ddiff.Days;

 if (hddiff > 2)

 img = "images/google/bred.gif";

 else if (hddiff > 1)

 img = "images/google/byellow.gif";

 else if (Convert.ToDouble(dataTable.Rows[j]["Speed"].ToString()) == 0)

 img = "images/google/utr0.png";

 else

  {

 img = "images/google/bgreen.gif";

if (angle == 0)

 {

  img = "images/google/utg0.png";

     }

else if (angle > 0 & angle <= 15)

 {

 img = "images/google/utg15.png";

 }

 else if (angle > 15 & angle <= 30)

 {

 img = "images/google/utg30.png";

 }

else if (angle > 30 & angle <= 45)

 {

 img = "images/google/utg45.png";

 }

 }