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 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
  • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序
  • ¥15 onvif+openssl,vs2022编译openssl64
  • ¥15 iOS 自定义输入法-第三方输入法
  • ¥15 很想要一个很好的答案或提示
  • ¥15 扫描项目中发现AndroidOS.Agent、Android/SmsThief.LI!tr
  • ¥15 怀疑手机被监控,请问怎么解决和防止
  • ¥15 Qt下使用tcp获取数据的详细操作
  • ¥15 idea右下角设置编码是灰色的