Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Regular Contributor
rakeshmjiyani
Posts: 66
Registered: ‎08-28-2010
My Device: 9630

GPS location latitude and longitude

Hi,

 

 I am making simple application in blackberry.  my application fetch latitude and longitude and calculate the distance.

 

My problem is as per below description.

 

if i set my networkmode to 2G then it retrive the latitude and longitude perfectly  as show in below image and also

my application work fine with showing distance and all.

 

 

'using_2G.jpg

 

Now if change my network mode to 2G & 3G then it is not working and give me latitude and longitude with loose of
decimal after precesion.

 

using_3G.jpg

 

can anyone help me so i can retrive the same latitude and longitude in 3G network as.

 

I am looking for urgent help on it.

 

Regards,

Please use plain text.
Developer
peter_strange
Posts: 19,609
Registered: ‎07-14-2008
My Device: Not Specified

Re: GPS location latitude and longitude

We have been round this loop before.

 

Please re-read what I wrote here:

http://supportforums.blackberry.com/t5/Java-Development/Latitude-and-longitude-problem/m-p/2303759#M...

 

Let me give you a simple example:  Have a look at this output:

 

First Value: 100.0

Second Value: 123.45

 

Now which of those two values is the most accurate?

 

You probably going to say the second one, in which case you are wrong.  Have a look at the code:

 

double d = 100.000000;
System.out.println("First Value: " + Double.toString(d));
d = 123.450;
System.out.println("Second Value: " + Double.toString(d));

 

The number of digits output after the decimal marker does NOT reflect how accurate the value is. 

 

There is another factor involved with locations.  From our previous discussion, you should be aware that locations come with values that indicate how accurate they actually are.  These accuracy values, that come with the QualifiedCoordinates, are what you should use to determine accuracy.  Not the number of digits after the decimal marker.

 

I hope it is now clear that from the figures you have obtained, you can not actually say that that the 2G location was more accurate than the 3G location. 

 

Now the issue is what can you say about the distances you are calculating?  That really is up to you.  The accuracy figures are given in standard deviations, so you should be able to give a 95% accurate figure by bounding your distance calculation within 2 standard deviations. 

 

If this is all too much, I would talk to one of friends who has done Math. I think significant figures and standard deviations and confidence levels associated with Bell curves are covered at High School, but that will depend on where you are.  I would expect someone who has done first year Math at University to be able to clarify this for you. 

 

Or perhaps the internet:

http://en.wikipedia.org/wiki/Significant_figures

http://en.wikipedia.org/wiki/Standard_deviation

Please use plain text.
Regular Contributor
rakeshmjiyani
Posts: 66
Registered: ‎08-28-2010
My Device: 9630

Re: GPS location latitude and longitude

Hi,

Peter

 

 I got your point. but  what is the difference between 2G and 3G. i am using the same Simcard.

 

If i set 2G & 3G then my precesion are loss. and if i set 2G then i get the precesion as i need. I know now you will say this will relay on network provider but how could it be ?  as what make change 2G and 3G so precesion are lost.

 

As for example precesion may not matter but for my applicaiton strongly relay on precesion. though it may not be accurate but at least i need that precesion for calculation.

 

I dont face any such kind of problem in android. it is really getting tough to stick with BB development.

 

Regards,

 

Please use plain text.
Developer
peter_strange
Posts: 19,609
Registered: ‎07-14-2008
My Device: Not Specified

Re: GPS location latitude and longitude

[ Edited ]

Before I respond to your post, you need to do some work.  Along with the location values you get, you should also output the value for horizontal accuracy in each case.  You get this from the QualifiedCoordinates object, method getHorizontalAccuracy().  Do that and compare the values in each of your cases.  Let us know what you see. 

 

Now back to your post. 

 

" I got your point..."

 

You have not got my point at all, if you say this:

 

"If i set 2G & 3G then my precesion are loss"

 

The number of digits that are output does not reflect the accuracy of a GPS location.

 

Please repeat this to yourself, and keep on repeating until it sinks in.  If it does not sink in then take this Thread and the other Thread along to someone who is mathematically trained and ask them to explain it.  I obviously can't.

 

"I dont face any such kind of problem in android"

 

You do.

 

Android has exactly the same problem.  If you look at the Location class you will find that it includes an accuracy value.  If you are not using this accuracy value when doing processing based on location, then you are not using the location properly

 

Every location that you get, from any service, is NOT your location.  It is the center of the device's best guess as to your location.  This is why your location is normally displayed as a point with a circle around it, the point indicates the best guess, the circle is the area you could be in.  The location is more accurate when the circle is smaller.  This has NOTHING to do with the number of digits after the decimal mark given for the best guess location. 

 

"it is really getting tough to stick with BB development"

 

This issue is nothing to do with BB development, it is more to do with me not being able to get you to understand the difference between the number of decimal digits and the accuracy.  If I can't get this through to you, then as I said, take this information to someone who has studied Maths and ask them to explain it to you. 

 

So I am asking you to do two things:

1) Accept that the accuracy of a GPS location is not reflected in the number of digits you get

2) Find out how accurate your two values really are.

 

I look forward to finding out how you get on. 

Please use plain text.