android - What does bearingTo(Location dest) exactly calculate? -


what bearingto(location dest) calculate? can please explain this??

thanks in advance.

 protected void oncreate(bundle savedinstancestate) {     destinationloc.setlatitude(39.543394);     destinationloc.setlongitude(-119.816010);     locationmanager lm =(locationmanager)getsystemservice(location_service);     string provider = lm.getbestprovider(new criteria(), true);     loc=lm.getlastknownlocation(provider)     }      public void onsensorchanged(sensorevent event) {     // todo auto-generated method stub       startloc.setlatitude(loc.getlatitude());       startloc.setlongitude(loc.getlongitude());     if ( startloc == null ) return;      float azimuth = event.values[0];     float baseazimuth = azimuth;     minitialposition.settext("initial latlong: " + startloc.getlatitude() + " " + startloc.getlongitude());     geomagneticfield geofield = new geomagneticfield( double             .valueof( startloc.getlatitude() ).floatvalue(), double             .valueof( startloc.getlongitude() ).floatvalue(),             double.valueof( startloc.getaltitude() ).floatvalue(),             system.currenttimemillis() );     azimuth += geofield.getdeclination(); // converts magnetic north true north      //correct azimuth     azimuth = azimuth % 360;      //this choose point     float direction = azimuth + startloc.bearingto( destinationloc );     float direction2 = startloc.bearingto(destinationloc); 

}

the direction2 value shown negative.

read documentation please. describes that method returns.

returns approximate initial bearing in degrees east of true north when traveling along shortest path between location , given location. shortest path defined using wgs84 ellipsoid. locations (nearly) antipodal may produce meaningless results.

parameters

dest destination location

returns

the initial bearing in degrees


Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -