how to determine if latitude and longitude is accurate - android

I am currently using the Network(wifi, data plans) to get latitude and longitude for Android (and iOS) phone. The documentation states that the coordinates may not be accurate(GPS is more accurate). Therefore, how can I determine if the Lat/Long coordinates given to me are accurate? Or, if they are not, how can I determine how much off they are?
added note: not sure if that answers my question. HOw can i use these coordinates to see if it is accurate. Im not concerned with how to program it.

Check this blog post Android: Location Updates with the FusedLocationApi
He uses fused location API to parse location data and keep track if coordinates are accurate. Hope that helps.

You can set your request to high accuracy such as the following command:
mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
And you can get the accuracy value from your location object such as:
myLocation.getAccuracy();
The best practice for the location to use the Fused Location API,

Related

FusedLocationProvider gives wrong location sometimes

I am using FusedLocationProviderClient to get location updates in a foreground service. On testing and observing for few days, I found wrong locations which was far away from my actual location by around 4 kms similar to this, but the LocationResult had an accuracy of 24 meters. How is this even possible?
It can be eliminated if the accuracy was around 4 kms. This behavior does not occur very often but occurs atleast once in 4 among 10 devices. It becomes a problem when I calculate distance traveled.
I can tell it's not a cached location because I used to turn off and on Location Services everyday. (As per docs, turning off Location Services clears cache location.)
Any idea why it's giving wrong location and how to eliminate it? And also clearing cache locations without turning off Location Services?
FusedLocationProvider CAN give incorrect results like that when gps connectivity for device is down(or insufficient satellites are in "view" to provide accurate data). It will use the nearest cell tower/location data provided by the wifi router(google tracks this automatically) giving WILDLY incorrect results in places where google doesn't have a strong location mapping presence - which is anywhere outside an urban center.
You have imho two options:
Use the non googleplay based solution based on location service - this has an option for ignoring non-gps location data(wifi/cellular).
LocationManager locationManager = (LocationManager)
getApplicationContext().getSystemService(LOCATION_SERVICE);
Location location = locationManager.getLastKnownLocation(LocationManager.GPS_Provider);
You can even specify the number of satellites required for acceptable data so you can get REALLY accurate location data. You will lose information when the gps doesn't receive coordinates (like indoors), but in exchange will have less "noise" from incorrectly mapped location, as per your requirement.
Use a "snap to roads" API. There is a free version using open street map data called Project OSRM(Open Source Routing Machine) that provides a backend when hosted (locally or in cloud) using docker or building source yourself (details in link).
curl "http://127.0.0.1:5000/route/v1/driving/13.388860,52.517037;13.385983,52.496891?steps=true"
This request will return a location that is "snapped" to the nearest road. There are various options such as giving priority to highways etc. You can then discard the points that are not on the "path" that the user was previously on as rapidly shifting to a road 4km away and then coming back again is not likely.

LocationProvider - Detecting highly inaccurate/incorrect locations

So I know you can use getAccuracy() to find the accuracy of a location but if you set up a cut off for the accuracy, can you prevent recording down one of those locations where it's hugely off mark of where the user is? Like if the user is still, most location updates cluster around his area but occasionally the location provider will hiccup and report the location as somewhere miles away.
Do these locations simply appear as "accurate" with getAccuracy? Or would they turn up as some insanely high getAccuracy() result? Programming a cut off point is easy enough but I was wondering if I would have to code extra checks such as if a location is way too different from the previous ones then it's a wayward one.
Accuracy is not the only deciding factor here. You should also look at the age of the location, and the provider if you get it (the Google Play Services location doesn't tell you, but the original Android LocationManager does).
In fact, Google has some useful sample code for maintaining a current best estimate. I have used a variation of this to filter out wild jumps in incoming location data. Essentially a location is not even reported if it doesn't pass this gate.

What is the difference to getting the location by using Location Manager and Fused Location Provider Api?

I need the real time difference to getting location using by Location Manager and Fused Api. I have checked with both, in Fused api(GPS) I am getting 7 digit after decimal point, but using by Location Manager(GPS) I will get nearly 15 digits after decimal point.
Which one is better to get accurate user current location?
What is the difference between Location Manager and Fused Api?
Why we need to migrate from Location Manager to Fused Api?
I used LocationRequest.PRIORITY_HIGH_ACCURACY, suppose I am in indoor, network is not available, how it returns the location?
Is it return the lastknown location, even I didn't write the code in onConnected()?
Related
Have found a previous answer for you, looks like FusedLocationProvider is going to be better
I think that the difference between them is that one use the physical sensor directly (Location Manager), where as other take assistance from the network/internet .
To me the more accurate is Location Manager but it takes some time and location detection speed depends on some factors such as you are on open place or not , weather etc..
I think the difference is:
Location Manager: you can choose specific resource provider such as
LocationManager.GPS_PROVIDER or LocationManager.NETWORK_PROVIDER
FusedLocation supplies a fast way to detect your location using combine of these provider above.

Android - how I can I achieve location accuracy in Google Map

I am self learning Android programming at the moment. I was about to write app that will display my location on map without using GPS.
I have tried using NETWORK_PROVIDER and found that my accuracy is constantly at 2000 even in city area with a lot of wifi around the area.
I would like to know how could other map application (e.g. GoogleMap) is able to achieve high accuracy without using GPS.
They use GPS. Or they lie about their accuracy. Ever seen the big blue circle around your position in Google Maps? That means they think you're somewhere in that circle, and are guessing about actual position.
The only way to get accuracy is to use GPS/GLONASS signals. A-GPS can help to fix position quickly because it provides info about which satellites are in view from your phone cell position (your device don't spend time trying to get signals from satellites not in view).
The 'High accuracy' mode is just a lie from Google to know your position all the time to monetize you in perverse ways
If you are using the network provider to fetch the location they are not very accurate. SO its not a good idea to fetch the accuracy of your position using
network provider. Its best to use GPS to get the location updates. You can use GetAccuracy() method of Location class and see for the value it returns.
Let Say if getAccuracy() retruns 25 then you can leave this value wait for another gps value which is more accurate.

how to get the most accurate location using GPS and AGPS with given time in android?

I have a below requirement.
Find location of user from GPS and AGPS. (we are going to use Samsung Galaxy ACE mobile phone)
Note: For every transaction first location will be the reference location for the next activities.
Below are the constraint which has to be considered while solving this problem.
user should be within 10meter range of the reference location. meaning (Reference location - current location) <= 10meter (distance calculation by Locaiton class API).
Location has to found in the given period of time.
let say 20-25sec for finding each locaiton. the time can be extended to max 35sec.
My user is always be outside of the Shop while taking the reference location and then inside for all the other activities.
What I am doing
find the reference location with accuracy of 30m with 25sec of time. store this in static variable.
find the location for next actiivty and calculate the difference. if difference >=10m tell user to perform that activity again.
My Queries
Is this possible with such fine accuracy in the distance with given Time and place?
How google calculate this distance?
Does google finds the location with such accuracy? or what is the accuracy of Google Map using GPS? for e.g. at given particular time and location given by the Google MAP by GPS how much it is accurate? like if i am standing near to my BANK then what is difference between co-ordinates on the google map on the server and the co-ordinate given by google map through GPS on mobile phone.
I have did enough experiment on this problem and finally came here for help.
i did the observation by doing variation in timing, place, accuracy. still need to find one final solution. as we have to answer the client whether it is possible or not?
The GPS can provide most accurate match but only outdoors. It is possible to achieve such accuracy but not guaranteed.
There are formulates for finding distance between two points on a sphere. However, for rough approximations euclidean distance can be tried.
The location and its accuracy depends on client side GPS. Google just reads it.

Categories

Resources