# Thread: Problem in getting speed and direction in gps

1. ## Problem in getting speed and direction in gps

I have started a project using gps and the coding is in j2me.I can locate the device in a map by getting latitude and longitude values. Time is also accessible.But when am trying to access the speed and direction the value getting is NaN.The code I have used is location.getSpeed(); and location.getCourse(); Where location is an object of type Location....So What I have to get the exact values of speed and direction...

2. ## Re: Problem in getting speed and direction in gps

Maybe a stupid question, but are you actually moving when you run your app and try to get the speed and direction?

3. ## Re: Problem in getting speed and direction in gps

Hi,

I also have problems with getting current direction of movement - the result is always NaN. So I wrote own algorithm:

http://wiki.forum.nokia.com/index.ph...on_of_movement

4. ## Re: Problem in getting speed and direction in gps

Actually all other values are getting correct...when am moving, latitude and longitude values are getting updated and I can map it correctly but only problem is with speed and direction...Only these two methods ie location.getSpeed(); and location.getCourse(); return NaN. This much portion is become a trouble for me...Need help from you.

5. ## Re: Problem in getting speed and direction in gps

Hi,
Thanks For ur reply..But would you please tell me whats actually,TReals type is it a long value or in degree minute second or some other format...I don't know much more about that calculation....

6. ## Re: Problem in getting speed and direction in gps

You should use long values for calculations. When you receive values of latitude and longitude - they presented in decimal system and it is good for calculation. But if you want to show latitude/longitude in dialogs you should translate them into deg, minutes and seconds.

http://wiki.forum.nokia.com/index.ph...how_a_landmark

7. ## Re: Problem in getting speed and direction in gps

Hi, Thanks for ur help...
I have made little changes to my code and now am getting the speed and directions from the device using location.getSpeed(); and location.getCourse(); methods. Below the changes that i made....
* cr.setSpeedAndCourseRequired(true); where cr is an instance of Criteria.
Before this I hadn't even set this. at that time its take its default value as false.that means doesn't required speed and course.

Anyway thanks for your valuable sugestion.

8. ## Re: Problem in getting speed and direction in gps

Thanks Darwin, very good information ! I was thinking my 6110 navigator doesn't provide this speed information, and it was a criteria default setting... I'll test it soon in my app.
Yann

Originally Posted by darwin_cyriac
Hi, Thanks for ur help...
I have made little changes to my code and now am getting the speed and directions from the device using location.getSpeed(); and location.getCourse(); methods. Below the changes that i made....
* cr.setSpeedAndCourseRequired(true); where cr is an instance of Criteria.
Before this I hadn't even set this. at that time its take its default value as false.that means doesn't required speed and course.

Anyway thanks for your valuable sugestion.

9. ## Re: Problem in getting speed and direction in gps

I'm shopping for a GPS phone. Forget maps, speed, and voice directions. I want the equivalent of a low cost Garmin hand held device. I want to walk out into the middle of nowhere, establish a waypoint, walk to point "b" and know the direction and distance. All without subscribing to the provider's service (AT&T)

10. ## Re: Problem in getting speed and direction in gps

Hi leom32w,
Welcome to the Forum Nokia Developer Discussion boards. This forum concentrates on development related issues. You can try to post your query at Nokia Support Discussions board - http://discussions.europe.nokia.com/

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•