Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    May 2014
    Posts
    1

    Speed calculation using HERE - Maps api ?

    Hi,

    I am using HERE- Maps api in my Windows Phone application.
    Please suggest me a method to calculate speed.?

    I have tried with assigning Accuracy to be high in geocoordinatewatcher. Then also I am getting speed as NaN.

    Thanks in advance.

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,185

    Re: Speed calculation using HERE - Maps api ?

    basically if it does not give you the speed with the data, then it is for some reason not available. Of course you could check the time between the positions and then use the functions provided in the corrdinate class to get the distance between them, and just calculate the speed from them

  3. #3
    Registered User
    Join Date
    May 2014
    Posts
    6

    Re: Speed calculation using HERE - Maps api ?

    I haven't yet tried it myself, but I believe that the following solution is quite reasonable.
    Say you are constantly tracking the location of your device. Doing this allows you to receive new coordinates (let's say you receive new coordinates every second).
    Thus, each second you should have two pairs of coordinates and should code your app so that the application would store them for a while:

    x1, y1 (where X is latitude and Y is longitude) - is where you are now
    x2, y2 (where X is latitude and Y is longitude) - is where you were exactly a second ago

    Say L is the distance that you covered in that second. Then mathematically:

    L = (arccos {sin(x1)·sin(x2) + cos(x1)·cos(x2)·cos(y1 - y2)})·R

    where R = 6371km - (Earth average radius)

    Given that the Earth isn't ideally round, using the average Earth radius will give you a slight error of 0.5% when calculating the distance that you covered.

    Once you have the distance L in kilometers:

    t=1/3600

    where t is that single second we're using.

    Then speed V would be:

    V=L/t
    V=L*3600

    Ultimately, the formula is

    V=(arccos {sin(x1)·sin(x2) + cos(x1)·cos(x2)·cos(y1 - y2)})·R·3600

    Which will give you the result in the metric system (i.e. km/h).

    NB:

    1. I do believe that there's a much simpler way to do that. I'll keep you updated once I find anything.
    2. I'm a lawyer and not a mathematician, so there might be some errors in my formulas, but I double checked it and it seems OK.

  4. #4
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,185

    Re: Speed calculation using HERE - Maps api ?

    the coordinate class has ready made function to get the distance, thus actually you can skip the math in there

  5. #5
    Registered User
    Join Date
    May 2014
    Posts
    6

    Re: Speed calculation using HERE - Maps api ?

    Quote Originally Posted by symbianyucca View Post
    the coordinate class has ready made function to get the distance, thus actually you can skip the math in there
    Lol) Great) I knew there had to be a shortcut, otherwise the math would take quite a while to hardcode)

Similar Threads

  1. GPS based speed calculation .
    By sreerajvr in forum Symbian
    Replies: 0
    Last Post: 2011-02-03, 14:14
  2. Is there a way to convert Maps Data from Nokia Maps 3 to be compatible with N Maps 2
    By dimchopicha in forum General Development Questions
    Replies: 6
    Last Post: 2011-01-09, 18:50
  3. How to analyze that KVM Speed and Canvas Speed settings in Emulator
    By chery209 in forum Mobile Java Tools & SDKs
    Replies: 0
    Last Post: 2010-10-14, 08:08
  4. calculation
    By sumit.rathi in forum Symbian
    Replies: 2
    Last Post: 2008-12-15, 13:27
  5. WLAN Speed : Is there any good way to improve E series downloading speed from 40k/s ?
    By haox_1982 in forum Wired and Wireless interfaces (Closed)
    Replies: 4
    Last Post: 2007-05-12, 13:11

Posting Permissions

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