Javascript 谷歌地图-绘制多边形线并在其上移动汽车
我正在研究车辆跟踪系统。 我有一个lat-long数组,如下所示:Javascript 谷歌地图-绘制多边形线并在其上移动汽车,javascript,php,google-maps,Javascript,Php,Google Maps,我正在研究车辆跟踪系统。 我有一个lat-long数组,如下所示: {"lat":"18.4560183333","lng":"73.8247583333"}, {"lat":"18.4537883333","lng":"73.8249266667"}, {"lat":"18.4547783333","lng":"73.8247633333"}, {"lat":"18.4534366667","lng":"73.8220883333"}, ... 现在我想画一条多边形线,把车移过去。 一模一样
{"lat":"18.4560183333","lng":"73.8247583333"},
{"lat":"18.4537883333","lng":"73.8249266667"},
{"lat":"18.4547783333","lng":"73.8247633333"},
{"lat":"18.4534366667","lng":"73.8220883333"},
...
现在我想画一条多边形线,把车移过去。
一模一样:
请帮帮我
LatLng currentPos = new LatLng(latitude, longitude);
carMarker.setPosition(currentPos);
double bearing = 0;
if(previousLocation!=null)
bearing = currentPos.bearingTo(previousLocation); // returns values between -180 to 180
float rotation = bearing;
if(rotation<0)
rotation= 360+rotation; //haven't checked this hope this will correct the angle
carMarker.setRotation(rotation); //to rotate the carMarker along the polyline
map.invalidate();
previousLocation = currentLocation;
LatLng currentPos=新LatLng(纬度、经度);
卡马克设定位置(当前位置);
双轴承=0;
if(上一个位置!=null)
轴承=当前位置轴承到(先前位置);//返回介于-180到180之间的值
浮动旋转=轴承;
如果(旋转)与本JSIDLE中相同: