2017-04-23 6 views
-1

私は車両追跡システムに取り組んでいます。今、私はポリ線を描画し、車上を移動したいGoogleマップ - ポリラインを描いて車を移動

{"lat":"18.4560183333","lng":"73.8247583333"}, 
{"lat":"18.4537883333","lng":"73.8249266667"}, 
{"lat":"18.4547783333","lng":"73.8247633333"}, 
{"lat":"18.4534366667","lng":"73.8220883333"}, 
... 

: は、私はこのような緯度長い配列を持っています。 同じように:https://jsfiddle.net/geocodezip/3b3j61pq/4/

私を助けてください。

+0

このjsiddleと同じ:http://jsfiddle.net/geocodezip/3b3j61pq/4/ –

答えて

0
  1. まだcarmarkerがトライ削除を移動し、それを追加されていない場合は遅延

    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; 
    

でlatlon配列を通じて、このコードとループを試してみてください車の画像

  • でマーカーを追加します。再びループ内

  • 関連する問題