Boa noite colegas, preciso de uma grande ajuda, estou desenvolvendo sistema de rastreamento e preciso que ao consultar o trajeto onde o veículo passou, o ponto inicial e final sejam identificados com outro ícone conforme imagem. Segue também código PHP abaixo e o JAVASCRIPT em imagem: while($RS= mysql_fetch_array($RSS)){ $x = $x + 1; $kx .= "new google.maps.LatLng(".str_replace(",", ".", $RS["vl_latitude"]).", ".str_replace(",", ".", $RS["vl_longitude"])."),"; if($RS["ig"] == "1"){$ig="LIGADA";}else{$ig="DESLIGADA";} if($x == 1){$pt = $pt . chr(91)."'INICIO: ".date("d/m/Y H:i:s", strtotime($RS["dt_hora"]))." - ".$RS["ds_posicao"]." | Ig: ".$ig."', ".str_replace(",", ".", $RS["vl_latitude"]).", ".str_replace(",", ".", $RS["vl_longitude"]).", ".$x."],";}else{$pt = $pt . chr(91)."' ".date("d/m/Y H:i:s", strtotime($RS["dt_hora"]))." - ".$RS["ds_posicao"]." | Ig: ".$ig."', ".str_replace(",", ".", $RS["vl_latitude"]).", ".str_replace(",", ".", $RS["vl_longitude"]).", ".$x."],";} $adata = $RS["dt_hora"]; if($RS["ig"] == "1"){$aig="LIGADA";}else{$aig="DESLIGADA";} //$aig = $RS["ig"]; $apos = $RS["ds_posicao"]; $alat = $RS["vl_latitude"]; $alng = $RS["vl_longitude"]; } $pt = $pt . chr(91)."'FIM: ".date("d/m/Y H:i:s", strtotime($adata))." - ".$apos." | Ig: ".$aig."', ".str_replace(",", ".", $alat).", ".str_replace(",", ".", $alng).", ".$x."],"; [![inserir a descrição da imagem aqui][1]][1] [![inserir a descrição da imagem aqui][2]][2] [1]: https://i.sstatic.net/IkVNY.png [2]: https://i.sstatic.net/OFhTI.png //AQUI ESTÁ TODO O CODIGO DO ARQUIVO. <?php include "../../conexaomaps.php";?> <!DOCTYPE html> <html> <head> <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> <style type="text/css"> html { height: 100% } body { height: 100%; margin: 0px; padding: 0px } #map_canvas { height: 100% } </style> <?php $kx = ""; $SQL = "select * from hist_posicao "; if($DdViagem != ""){$SQL .= " where cd_viagem = '".$DdViagem."' ";} if($cd_veiculo != ""){$SQL .= " where cd_veiculo = '".$cd_veiculo."' and dt_hora >= '".DtBrToDtEua($TxDe,4)."' and dt_hora <= '".DtBrToDtEua($TxAte,4)."' ";} if($cd_mct != ""){$SQL .= " and cd_mct = '".$cd_mct."' ";} if($cd_bkp != ""){$SQL .= " and cd_bkp = '".$cd_bkp."' ";} if($cd_velo == 1){$SQL .= " and vl_velocidade > 0 ";} if($cd_velo == 2){$SQL .= " and vl_velocidade = 0 ";} if($cd_velo == 3){$SQL .= " and vl_velocidade > '".$limitevel."'";} $SQL .= " order by dt_hora asc "; $RSS = mysql_query($SQL, $conexao); while($RS= mysql_fetch_array($RSS)){ $x = $x + 1; $kx .= "new google.maps.LatLng(".str_replace(",", ".", $RS["vl_latitude"]).", ".str_replace(",", ".", $RS["vl_longitude"])."),"; if($RS["ig"] == "1"){$ig="LIGADA";}else{$ig="DESLIGADA";} if($x == 1){$pt = $pt . chr(91)."'INICIO: ".date("d/m/Y H:i:s", strtotime($RS["dt_hora"]))." - ".$RS["ds_posicao"]." | Ig: ".$ig."', ".str_replace(",", ".", $RS["vl_latitude"]).", ".str_replace(",", ".", $RS["vl_longitude"]).", ".$x."],";}else{$pt = $pt . chr(91)."' ".date("d/m/Y H:i:s", strtotime($RS["dt_hora"]))." - ".$RS["ds_posicao"]." | Ig: ".$ig."', ".str_replace(",", ".", $RS["vl_latitude"]).", ".str_replace(",", ".", $RS["vl_longitude"]).", ".$x."],";} $adata = $RS["dt_hora"]; if($RS["ig"] == "1"){$aig="LIGADA";}else{$aig="DESLIGADA";} //$aig = $RS["ig"]; $apos = $RS["ds_posicao"]; $alat = $RS["vl_latitude"]; $alng = $RS["vl_longitude"]; //$pt = $pt . chr(91)."'".date("d/m/Y H:i:s", strtotime($adata))." - ".$apos." | Ig: ".$aig."', ".str_replace(",", ".", $alat).", ".str_replace(",", ".", $alng).", ".$x."],"; } $pt = $pt . chr(91)."'FIM: ".date("d/m/Y H:i:s", strtotime($adata))." - ".$apos." | Ig: ".$aig."', ".str_replace(",", ".", $alat).", ".str_replace(",", ".", $alng).", ".$x."],"; ?> <script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=false"></script> <script type="text/javascript"> function initialize() { var myOptions = { zoom: 7, center: new google.maps.LatLng(-27.2317, -52.0294), mapTypeId: google.maps.MapTypeId.ROADMAP }; var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); setMarkers(map, beaches); //CRIACAO DE LINHAS var flightPlanCoordinates = [<?php echo substr($kx,0, (strlen($kx)-1));?>]; //busca valores vindos do while do BD. var flightPath = new google.maps.Polyline({ path: flightPlanCoordinates, //recebe variavel com valores do while vindos do BD. strokeColor: "#FF0000", strokeOpacity: 1.0, strokeWeight: 2 }); flightPath.setMap(map); } var beaches = [<?php echo substr($pt,0, (strlen($pt)-1));?>]; function setMarkers(map, locations) { var image = new google.maps.MarkerImage('../../imagens/car_mini.png', new google.maps.Size(20, 32), new google.maps.Point(0,0), new google.maps.Point(0, 10)); var shape = { coord: [1, 1, 1, 20, 18, 20, 18 , 1], type: 'poly' }; for (var i = 0; i < locations.length; i++) { var beach = locations[i]; var myLatLng = new google.maps.LatLng(beach[1], beach[2]); var marker = new google.maps.Marker({ position: myLatLng, map: map, icon: image, shape: shape, title: beach[0], zIndex: beach[3] }); } } </script> </head> <body onLoad="initialize()"> <div id="map_canvas" style="width:100%; height:100%"></div> </body> </html>