如何获得针对当前位置经纬度值中的一个或两个仪表精度 [英] How to get one or two meter accuracy for Latitude and longitude values for Current Location

查看:200
本文介绍了如何获得针对当前位置经纬度值中的一个或两个仪表精度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

越来越纬度,经度值的一个或两个建筑物路程,没有得到确切的纬度和经度values​​.I想获得的纬度和经度值用于至少一个或两个仪表精度为当前Location.This是code

 公共类GPSLocatorActivity扩展MapActivity实现OnClickListener {
MapView类MapView类= NULL;
MapController mapController = NULL;
MyLocationOverlay WHEREAMI = NULL;
私人按钮bdiffaddr,bnext编辑;
MyLocation myLocation;
GeoPoint的P = NULL;
MapController MC = NULL;
公共静态的LocationManager locManager;
保护ProgressDialog progressDialog;
公共静态双纬度,经度;
公共字符串标记=GPSLocatorActivity;保护布尔isLocationDisplayed(){
    返回whereAmI.isMyLocationEnabled();
}
保护布尔isRouteDisplayed(){
    返回false;
}
公共无效的onCreate(捆绑savedInstanceState){
    super.onCreate(savedInstanceState);
    的setContentView(R.layout.gpslocation);
    initialiseviews();
    //听众的onclick
    onclicklisteners();
    currentLocLatLong();
    //新GoogleMapAsyncTask()执行();
    GPSLocatorActivity.this.runOnUiThread(新的Runnable(){
        公共无效的run(){
            图形页面=(图形页面)findViewById(R.id.mapView);
            mapView.setBuiltInZoomControls(真);
            mapController = mapView.getController();
            mapController.setZoom(15);
            WHEREAMI =新MyLocationOverlay(GPSLocatorActivity.this,
                    图形页面);
            调用MapView.getOverlays()加(WHEREAMI)。
            mapView.postInvalidate();
        }
    });}
公共类GoogleMapAsyncTask扩展的AsyncTask<太虚,太虚,太虚> {
    保护无效doInBackground(虚空......空隙){
        图形页面=(图形页面)findViewById(R.id.mapView);
        mapView.setBuiltInZoomControls(真);
        mapController = mapView.getController();
        mapController.setZoom(15);
        WHEREAMI =新MyLocationOverlay(GPSLocatorActivity.this,MapView类);
        调用MapView.getOverlays()加(WHEREAMI)。
        mapView.postInvalidate();
        返回null;
    }}
私人无效currentLocLatLong(){
    locManager =(的LocationManager)getSystemService(Context.LOCATION_SERVICE);
    locManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,100L,
            100.0f,LocationListener的);
    地点= locManager
            .getLastKnownLocation(LocationManager.GPS_PROVIDER);
    如果(位置!= NULL){
        纬度= location.getLatitude();
        经度= location.getLongitude();
    }
}
私人无效updateWithNewLocation(地点){
        串latLongString =;
    Log.d(纬度:北纬+ + \\ nLong:+经度,纬度:+纬度
            +\\ nLong:+经度);
    如果(位置!= NULL){
        纬度= location.getLatitude();
        经度= location.getLongitude();
        latLongString =纬度:+纬度+\\ nLong:+经度;
    }其他{
        latLongString =没有发现地点;
    }
}
公共无效onResume(){
    super.onResume();
    whereAmI.enableMyLocation();
    whereAmI.runOnFirstFix(新的Runnable(){
        公共无效的run(){
            mapController.setCenter(whereAmI.getMyLocation());
        }
    });}
公共无效的onPause(){
    super.onPause();
    whereAmI.disableMyLocation();
}
公共无效onLocationChanged(地点){
    如果(位置!= NULL){
        纬度= location.getLatitude();
        经度= location.getLongitude();
        @燮pressWarnings(未使用)
        字符串currentLocation =纬度:+纬度+LNG+经度;
        // txted.setText(currentLocation);
        P =新的GeoPoint((int)的纬度* 1000000,
                (INT)经度* 1000000);
        mc.animateTo(P);
    }
}
公众最终LocationListener的LocationListener的=新LocationListener的(){
    公共无效onLocationChanged(地点){
        updateWithNewLocation(位置);
    }
    公共无效onProviderDisabled(字符串提供商){
        updateWithNewLocation(NULL);
    }
    公共无效onProviderEnabled(字符串提供商){
    }
    公共无效onStatusChanged(字符串提供商,INT地位,捆绑演员){
    }
};请帮助,如果任何人有想法如何获取的准确性高达一两米的距离。


解决方案

对不起,您无法通过编程提高准确性。精度接收多个卫星或通过使用更准确的GPS硬件或(使用在航空像WAAS)扩展系统增大。此外,接收更好的建筑之外,并从该卫星的直接视线任何障碍了。

要确定你有多少卫星接收,你可以看看这里: http://stackoverflow.com/a/8747795/1127492

BTW 2米为pretty具有挑战性。欲了解更多信息,精度在这里看到: http://www.gps.gov/系统/ GPS /性能/精度/#

区别

getting lat,lon values one or two buildings away and not getting the exact lat and lon values.I am trying to get atleast one or two meter accuracy for Latitude and longitude values for Current Location.This is the code

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 + \nLong: + longitude", "Lat:" + latitude
            + "\nLong:" + longitude);
    if (location != null) {
        latitude = location.getLatitude();
        longitude = location.getLongitude();
        latLongString = "Lat:" + latitude + "\nLong:" + 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.

解决方案

Sorry, you cannot increase accuracy by programming. Accuracy increases with receiving more satellites or by using a better GPS hardware or extended systems (like WAAS using in aviation). Additionally, reception is better outside of buildings and away from any obstacles in the direct line of sight to the satellites.

To determine how many satellites you are receiving, you may look here: http://stackoverflow.com/a/8747795/1127492

BTW, 2 meters is pretty challenging. For more information on accuracy see here: http://www.gps.gov/systems/gps/performance/accuracy/#difference

这篇关于如何获得针对当前位置经纬度值中的一个或两个仪表精度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆