qq_30415023 2016-09-21 11:24 采纳率: 0%
浏览 1956
已结题

国内谷歌定位偏移怎么办?

国内谷歌定位偏移怎么办?地图的偏移纠正过来了,但是定位点还是在那,没动,怎么修正定位的偏移呢?定位的源码
private void setupMap() {

    // Do a null check to confirm that we have not already instantiated the map.
    if (mGoogleMap == null) {
        // Try to obtain the map from the SupportMapFragment.
        ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMapAsync(new OnMapReadyCallback() {
            @Override
            public void onMapReady(GoogleMap googleMap) {
                mGoogleMap = googleMap;
                mGoogleMap.setIndoorEnabled(true);

                if (ContextCompat.checkSelfPermission(MapAct.this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
                    ActivityCompat.requestPermissions(MapAct.this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, LOCATION_PERMISSION_ID);
                    return;
                }
                mGoogleMap.setMyLocationEnabled(true);
                mGoogleMap.setOnMyLocationChangeListener(new GoogleMap.OnMyLocationChangeListener() {
                    @Override
                    public void onMyLocationChange(Location location) {

                        speed = (int) ((location.getSpeed() * 3600) / 1000);

                        Log.e("mahi ", "speed" + speed);

// TranslateGps.gcj_To_Gps84(location.getLatitude(),location.getLongitude())
mGoogleMap.animateCamera(CameraUpdateFactory.newLatLngZoom(
new LatLng( TranslateGps.gps84_To_Gcj02(location.getLatitude(),location.getLongitude()).getWgLat(),
TranslateGps.gps84_To_Gcj02(location.getLatitude(),location.getLongitude()).getWgLon()), 15));

                        LatLng latlng = new LatLng(location.getLatitude(), location.getLongitude());

// AMapUtil.transformFromGCJToWGS(latlng);
if (status) {
points.add(latlng);

// redrawLine();
}

                        System.out.println("mahi onLocation Changed Call");

                    }
                });

            }
        });

        // Check if we were successful in obtaining the map.
        if (mGoogleMap != null) {

        }
    }
}
  • 写回答

1条回答 默认 最新

  • RoidCoder 2016-09-21 12:52
    关注

    国内建议不要使用谷歌定位,毕竟难以跨越那一道墙。而且谷歌已然放弃了中国的市场,相关的服务也会相对滞后

    评论

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?