在我的應用程序中,我想從north.is計算具體位置(經緯度和長度都給出)的角度。有沒有什麼辦法來計算這個。實際上,我發現把手機的方向,但我想獲得角度從north.here位置是我的code.please提出任何有關solution.Thankx如何從android中獲取任何地理位置的角度?
myAzimuth=Math.round(event.values[0]);
myPitch=Math.round(event.values[1]);
myRoll=Math.round(event.values[2]);
Toast.makeText(this, "Value"+myAzimuth, Toast.LENGTH_SHORT).show();
if(myAzimuth<22){
Toast.makeText(this, "North Direction", Toast.LENGTH_SHORT).show();
}
else if (myAzimuth >= 22 && myAzimuth < 67)
Toast.makeText(this, "North East", Toast.LENGTH_SHORT).show();
else if (myAzimuth >= 67 && myAzimuth < 112)
Toast.makeText(this, "East Direction", Toast.LENGTH_SHORT).show();
else if (myAzimuth >= 112 && myAzimuth < 157)
Toast.makeText(this, "South east Direction", Toast.LENGTH_SHORT).show();
else if (myAzimuth >= 157 && myAzimuth < 202)
Toast.makeText(this, "South Direction", Toast.LENGTH_SHORT).show();
else if (myAzimuth >= 202 && myAzimuth < 247)
Toast.makeText(this, "South west Direction", Toast.LENGTH_SHORT).show();
else if (myAzimuth >= 247 && myAzimuth < 292)
Toast.makeText(this, "west Direction", Toast.LENGTH_SHORT).show();
else if (myAzimuth >= 292 && myAzimuth < 337)
Toast.makeText(this, "North west Direction", Toast.LENGTH_SHORT).show();
else if (myAzimuth >= 337)
Toast.makeText(this, "North Direction", Toast.LENGTH_SHORT).show();
[相關問題](http://stackoverflow.com/questions/4308262/calculate-compass-bearing-heading-to-在Android中的位置) – st0le
你知道經度和緯度是從赤道和格林威治經度測量的嗎?北極緯度北緯90度,經度0度。你剛剛計算出手機用戶在哪個方向旅行? – ChrisBD
如果myAzimuth位於(0-21),那麼方向是什麼? – Khawar