English 中文(简体)
如何为目前地点的纬度和纬度值达到一或两米精确度
原标题:How to get one or two meter accuracy for Latitude and longitude values for Current Location
  • 时间:2012-01-13 15:08:35
  •  标签:
  • android

getting积一两栋楼房,不折抵混凝土和lon。 我正试图对目前地点的纬度和纬度值达到一或两米精确度。 这是法典。

public class GPSLocatorActivity extends MapActivity implements OnClickListener {
MapView mapView = null;
MapController mapController = null;
MyLocationOverlay whereAmI = null;
private Button bdiffaddr, bnext;
MyLocation myLocation;
GeoPoint p = null;
MapController mc = null;
public static LocationManager locManager;
protected ProgressDialog progressDialog;
public static double latitude, longitude;
public String TAG = "GPSLocatorActivity";

protected boolean isLocationDisplayed() {
    return whereAmI.isMyLocationEnabled();
}
protected boolean isRouteDisplayed() {
    return false;
}
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.gpslocation);
    initialiseviews();
    // onclick listeners
    onclicklisteners();
    currentLocLatLong();
    // new GoogleMapAsyncTask().execute();
    GPSLocatorActivity.this.runOnUiThread(new Runnable() {
        public void run() {
            mapView = (MapView) findViewById(R.id.mapView);
            mapView.setBuiltInZoomControls(true);
            mapController = mapView.getController();
            mapController.setZoom(15);
            whereAmI = new MyLocationOverlay(GPSLocatorActivity.this,
                    mapView);
            mapView.getOverlays().add(whereAmI);
            mapView.postInvalidate();
        }
    });

}
public class GoogleMapAsyncTask extends AsyncTask<Void, Void, Void> {
    protected Void doInBackground(Void... voids) {
        mapView = (MapView) findViewById(R.id.mapView);
        mapView.setBuiltInZoomControls(true);
        mapController = mapView.getController();
        mapController.setZoom(15);
        whereAmI = new MyLocationOverlay(GPSLocatorActivity.this, mapView);
        mapView.getOverlays().add(whereAmI);
        mapView.postInvalidate();
        return null;
    }

}
private void currentLocLatLong() {
    locManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
    locManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 100L,
            100.0f, locationListener);
    Location location = locManager
            .getLastKnownLocation(LocationManager.GPS_PROVIDER);
    if (location != null) {
        latitude = location.getLatitude();
        longitude = location.getLongitude();
    }
}
private void updateWithNewLocation(Location location) {
        String latLongString = "";
    Log.d("Lat: + latitude + 
Long: + longitude", "Lat:" + latitude
            + "
Long:" + longitude);
    if (location != null) {
        latitude = location.getLatitude();
        longitude = location.getLongitude();
        latLongString = "Lat:" + latitude + "
Long:" + longitude;
    } else {
        latLongString = "No location found";
    }
}
public void onResume() {
    super.onResume();
    whereAmI.enableMyLocation();
    whereAmI.runOnFirstFix(new Runnable() {
        public void run() {
            mapController.setCenter(whereAmI.getMyLocation());
        }
    });

}
public void onPause() {
    super.onPause();
    whereAmI.disableMyLocation();
}
public void onLocationChanged(Location location) {
    if (location != null) {
        latitude = location.getLatitude();
        longitude = location.getLongitude();
        @SuppressWarnings("unused")
        String currentLocation = "Lat: " + latitude + " Lng: " + longitude;
        // txted.setText(currentLocation);
        p = new GeoPoint((int) latitude * 1000000,
                (int) longitude * 1000000);
        mc.animateTo(p);
    }
}
public final LocationListener locationListener = new LocationListener() {
    public void onLocationChanged(Location location) {
        updateWithNewLocation(location);
    }
    public void onProviderDisabled(String provider) {
        updateWithNewLocation(null);
    }
    public void onProviderEnabled(String provider) {
    }
    public void onStatusChanged(String provider, int status, Bundle extras) {
    }
};

please help if anyone has idea how to get the accuracy upto one or two meter distance.
问题回答

职业介绍会无法通过方案提高准确性。 随着接收更多的卫星,或通过使用更好的全球定位系统硬件或扩展系统(如使用航空的WAAS)来提高准确性。 此外,在建筑物外的接收更好,而且远离卫星直接视线上的任何障碍。

为确定您接收的卫星数量,您可在此查阅:https://stackoverflow.com/a/8747795/1127492

BTW,2米的人相当具有挑战性。 关于准确性的更多信息见:





相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签