Precision Radius - Googlemaps

Asked

Viewed 86 times

2

It is possible to identify when the radius of precision is small?

In the examples below when I open the application it is very far from my location, with a very large radius, in the next the radius is very small and the location is correct.

First image:

inserir a descrição da imagem aqui

Second image:

inserir a descrição da imagem aqui

To get a location I’m using:

public class MapsActivity extends FragmentActivity implements OnMapReadyCallback, NavigationView.OnNavigationItemSelectedListener, GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener {

private GoogleMap mMap;
Location location;
GoogleApiClient mapGoogleApiClient;
FloatingActionButton myLoc, mt;
String latMt, logMt, t1, t2;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_maps);

    Intent intent = getIntent();
    latMt = intent.getStringExtra("latmt");
    logMt = intent.getStringExtra("logmt");

    if (mapGoogleApiClient == null) {
        mapGoogleApiClient = new GoogleApiClient.Builder(this)
                .addConnectionCallbacks(MapsActivity.this)
                .addOnConnectionFailedListener(MapsActivity.this)
                .addApi(LocationServices.API)
                .build();
    }

    // Obtain the SupportMapFragment and get notified when the map is ready to be used.
    SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
            .findFragmentById(R.id.map);
    mapFragment.getMapAsync(this);

 myLoc = (FloatingActionButton) findViewById(R.id.locat);

  //Isto é tipo um setMyLocationEnabled

  myLoc.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (GetLocalization(MapsActivity.this)) {
                if (ActivityCompat.checkSelfPermission(MapsActivity.this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(MapsActivity.this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
                    // TODO: Consider calling
                    return;
                }
                location = LocationServices.FusedLocationApi.getLastLocation(mapGoogleApiClient);
                if (location != null) {
                    t1 = (String.valueOf(location.getLatitude()));
                    t2 = (String.valueOf(location.getLongitude()));

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

                    CameraPosition.Builder builder = new CameraPosition.Builder();
                    builder.zoom(15);
                    builder.target(target);

                    mMap.animateCamera(CameraUpdateFactory.newCameraPosition(builder.build()));

                    TraceRoute trace = new TraceRoute();
                    trace.execute(latMt + "," + logMt, t1 + "," + t2);

                } else {
                    Snackbar.make(v, "Localização não encontrada, aguarde um pouco!", Snackbar.LENGTH_LONG)
                            .setAction("Action", null).show();
                }
            }
        }
    });
  • I’ve always wondered too. I wish I could put a reward on this question now.

  • I understand that the difference between the two images is the zoom, can’t be sure about the accuracy (unless you increase the zoom at first).

  • I found the question interesting, but I do not understand if the doubt is related to zoom, at a scale that the google uses at each level of zoom or to precision (like "I’m here and the marker shows from across the street")

  • @Well, man, the first picture, the radius of precision is about 3 miles, the second one is not 2 meters, as the difference is in the zoom? The first picture the location shown is almost 10 km from my house

  • I understood.. so for me the question is also valid :P

  • @rLinhares The question was marked as duplicate, I looked at the other and it really worked, with getAccuracy the first image returned 4089, waited for my right location and looked dnv, returned 10, so I compared here when it is less than 25, the accuracy is practically correct

  • @Wotonsampaio mass, vlw the information

Show 2 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.