我正在制作一个实时的Tracker,它正在向服务器发送纬度和经度,然后我正在绘制一条多边形线 在点的基础上,但问题是它不是根据多边形线绘制的。显示直线。我使用谷歌地图api v3 javascript,只是简单地显示一个简单的折线。我不知道为什么它不是根据点绘制 .can任何人都可以帮助我顺利完成。
我每隔30秒就会保存一次积分,但它仍会画出很大的直线。它应该绘制与每个点连接的小线条吗? 这是我的编码
function initialize(data, total) {
directionsDisplay = new google.maps.DirectionsRenderer();
var mapOptions = {
zoom : 15,
center : new google.maps.LatLng(28.5475468, 77.2112022),
};
var map = new google.maps.Map(document.getElementById('map-canvas'),
mapOptions);
directionsDisplay.setMap(map);
var mypath = new Array();
// Parse the array of LatLngs into Gmap points
for(var i=0; i <= total; i++){
//Tokenise the coordinates
// alert(i);
mypath.push(new google.maps.LatLng( data[i].lat_position, data[i].long_position ));
}
var lineSymbol = {
path: 'M 0,-1 0,1',
strokeOpacity: 1,
scale: 4
};
// Create the polyline, passing the symbol in the 'icons' property.
// Give the line an opacity of 0.
// Repeat the symbol at intervals of 20 pixels to create the dashed effect.
var line = new google.maps.Polyline({
path: mypath,
strokeOpacity: 0,
icons: [{
icon: lineSymbol,
offset: '0',
}],
map: map
});
}
///////////////////////////data which is coming from server///////////////////////////////
public function getmeaddressAction(){
$boyid=$_POST['id'];
//echo $boyid; die;
$output=$this->_model->getmeaddress($boyid);
header('Content-Type: application/json');
echo json_encode($output);
die;
}
//////////////////////////////////////////////// and model is////////////////////////////
function getmeaddress($boyid)
{
$sql='select * from trackposition where delivery_boy_id='.$boyid.' order by id ASC ';
$data=$this->fetchAll($sql);
return $data;
}