Program shown above : fetch location coordinates compares with location data stored in airtable spreadsheet if current location coordinates match with location data program should store name and loc of respective loc in text inputs but this program giving different results when I’m pressing button more than one time
That is because the GPS returns a location with a certain level on uncertainty, because of distortions from the ionosphere. While your precise location will be usually within 3 or 4 m, from sample to sample, it can drift to 10 m or more when one satellite gets out of view and another one is used as reference.
Moreover, 3 m is 0.000027 degree at the equator (and more at other latitudes), so you are almost sure the value of the 5th decimal will change all the time.
5th decimal changing but i have given provision for that also in my blocks by taking differnce between two lat and two longs and multiply by 10000000 and if the differnce less than 5000 im considering it as requred loc and taking other properties from the row and setting those(NAME,LOC) in text inputs but when i,m pressing button its giving correct properties for the first time and when im keep on pressing button its giving properties of other loc how to resolve this problem kindly help me yaaaaaaaaaaaaaaaar im getting frustraion bcz im trying this since one week.
i have posted pics of my mobile
first time its shown wrong property of loc(OGl-OGL TOWN FEEDER)
second time shown correct values of (132KV SS OGL)
third time correct
4th time there is no value
5th time also there is no value
Hold on a second here.
You are at 80 latitude???
At that latitude, one degree of longitude is only 19 km, as opposed to 111 at the equator.
Your GPS reading will see the 4th decimal change all the time.
And because of the high angle, there may be less satellites in view, and their signal will pass trough the most perturbed area of the ionosphere. Are there auroral activities these days?
There are apps available (I got one for my Android phone) that will show you the satellites in view and tell you what kind of precision you can expect on a GPS fix. Use that value to derive what kind of precision you can hope to get in terms of longitude. I have a hunch you cannot hope to get a stable 4th decimal – even at my comparatively comfortable 45 N latitude, I see the fix a lot more jittery than usual today (that is why I am wondering about auroras).
its oky but i have seen with same lat and long values im getting different results
i dont get what is the problem
im thinking problem with variables
see that in 1st pic and second pic lat long values were same but giving different results ?
That may depend on how quickly your values get refreshed.
Are you making you calculation form the same variable and value? Or are you sampling them independently?
seee my blocks sir?
im getting problem with the variables sir see my blocks
Where are you on the planet? Your first images made it look like Lattitude 80, but your table shows Longitude 80.
That puts you a lot closer to the equator.
Do you always click Button2 before clicking Button1 a second time?
And I do not understand why you feel the need to multiply all the values by 10000000.
Bcz if I don’t the difference not coming and that button 2 used for making all variables to null
Yes I always press button2 before pressing button 1
There are several weakness in your approach.
Besides the useless multiply by 10 million and compare to 9000, when you could not multiply and compare with 0.0009 just the same; the way you set the value of "Label1"and “Label2” to the same current position as many times as the loop will have to run to find a match.
Mathematically, you are trying to find a mach in some sort of rectangle based on limited difference in latitude and longitude values, where a more satisfactory approach would be to find the distance between the current and one of the potential target location, using the haversine formula. Your current method would produce vastly different quality of match in a different part of the world, the haversine formula would work anywhere on the planet.
A minor weakness is that you do not have provision in case the spreadsheet access returns an error. While debugging a program, you should at least make your program present–using the Alert–the current values you are dealing with. If there is an error in the database, for whatever reason, you fall in the trap of “garbage in; garbage out” without even seeing the reason for it.
But I noticed that you changed your blocks, but the original result images were those of the original progran.
And if you wonder why the last case (80.0370858 15.5129154) did not return anything, is that because there isn’t anything close enough in your spreadsheet.
If I was to run your app on my machine here, there is no chance it will get anything because I am on the other side of the planet. Your program needs to cater with the “didn’t find anything” case in an explicit manner (and by this, I mean should not require to use button2 to clear, the button1 should clear by itself, so that forgetting to click button2 does not affect result).
Basically, you claimed that the 1st case was the one with wrong result.
A first case is always suspicious because it will use variables that were set by default, or were result of a previous iteration. You have to actively blank everything.
And check your intermediate results. You cannot find where the problem is if you only look at the final result, all you will ever know is that something, somewhere is not working.
Thnaku for giving suggestions yaar
and what points u said everything correct
Here the case is different
1)there is no pblm with location sensor
Reason: above five cases it’s giving same value
2)there is no pblm with button 2
Reason:if I remove that one giving same response
3)I checked all variables I have these variables giving different values when I pressed button more than one time
Please tell me the way how to resolve the issue with this app variables in loops
Note:same program I have tried with stored variables also same response coming.