【问题标题】:How do i get camera view region latitude and longitude and also user direction of camera view in android我如何在android中获取相机视图区域的纬度和经度以及相机视图的用户方向
【发布时间】:2013-09-06 05:13:40
【问题描述】:

您好,我是 android 应用程序开发的新手。我需要从以下场景开发应用程序:

  1. 首先我需要获取用户摄像头观察方向的方向(如北、南、东、西)。
  2. 其次我如何计算相机视图区域/面积
  3. 第三我如何过滤相机视图区域的纬度和经度

如果您没有收到我的问题,我附上图片以供您理解

我对此一无所知。请任何人帮助开发应用程序。

提前致谢

【问题讨论】:

    标签: android geolocation android-camera latitude-longitude


    【解决方案1】:

    对于第 1 步:

    您需要一种指南针来向用户显示方向:

    http://sunil-android.blogspot.com/2013/02/create-our-android-compass.html

    对于第 2 步:您需要进行一些数学计算。

    对于第 3 步:

    你必须得到你捕获图像的当前位置的纬度和经度:

    像这样实现你的类:实现 LocationListener

    LocationManager mLocationManager;
    
    mLocationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
    
            Location location = mLocationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
            if(location != null) {
                lat = location.getLatitude();
                lng = location.getLongitude();
                getWeatherInfo();
            }
            else {
                mLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, this);
                Toast.makeText(ClimateInfo.this,"GPS / Internet not available, please check the connections and retry!",Toast.LENGTH_LONG).show();
            }
    
    @Override
        public void onLocationChanged(Location location) {
            if (location != null) {
                Log.v("Location Changed", location.getLatitude() + " and " + location.getLongitude());
                lat = location.getLatitude();
                lng = location.getLongitude();
            }
    
        }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-11-05
      • 2018-05-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多