Discussion Board

Results 1 to 11 of 11
  1. #1
    Registered User dtorrent's Avatar
    Join Date
    Mar 2010
    Posts
    9
    Hello

    I'm looking for a proven code to get gps distance between two coordinates. I'm using some code for this but sometimes doesn't work. Let me explain.

    In my application I get a list of interesting locations near to me. The problem is sometimes the list I get seems to be correct but sometimes I get some locations that are kiliometers away and I know in the list some near locations are missing.

    I don't know why the code I use sometimes is running, sometimes not. I would like to try with another code and compare the results. I don't have here the code I using, I will post it later.

    Thanks

    David

  2. #2
    Registered User dtorrent's Avatar
    Join Date
    Mar 2010
    Posts
    9
    I'm thinking about it and correct me if I'm wrong but, could be that when I'm getting the right list is because I'm using the GPS coordinates and when I'm getting the 'bad' list is because I'm in the office (for example ) and I'm getting my localization via gsm antenna?

    David

  3. #3
    Nokia Developer Moderator wizard_hu_'s Avatar
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    27,680
    If you are interested about local things only, I think a simple Euclidean distance calculated on latitude and longitude is adequate enough.
    When there are interference/delay/reflections because you are inside a building, it is more likely that you get false readings from the GPS itself, that is why the vicinity list seems to be calculated for an other location. Because it is really calculated for an other location.

  4. #4
    Registered User devfish's Avatar
    Join Date
    Dec 2011
    Location
    Tampa Bay, FL
    Posts
    3
    The formula you are looking for is called "great circle distance". There's a javascript version of it here ( http://www.movable-type.co.uk/scripts/latlong.html ) which would be pretty easy to translate to .NET . Let me know if you need some help translating it to C# or VB.

  5. #5
    Super Contributor mahbub_s60's Avatar
    Join Date
    Mar 2008
    Posts
    1,481
    Have you checked this?
    http://www.developer.nokia.com/Commu..._two_landmarks

    You are doing application for windows phone?

  6. #6
    Nokia Developer Expert symbianyucca's Avatar
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    28,664
    What about using actual API: http://msdn.microsoft.com/en-us/libr...=VS.92%29.aspx check the function GetDistanceTo

  7. #7
    Registered User hclchd's Avatar
    Join Date
    Dec 2011
    Posts
    6
    i think the diff of longitude and lattitude will give radial distance it would be better if actual api is used or try updating map database

  8. #8
    Registered User dtorrent's Avatar
    Join Date
    Mar 2010
    Posts
    9
    Thanks for your answers

    Yes, I'm developing for Windows Phone and I knew about the GetDistanceTo but I'm not using it. Could be for some reason that I don't remember now but I'll check it again, thanks!

  9. #9
    Registered User kangaderoo's Avatar
    Join Date
    Nov 2010
    Posts
    10
    It all depends a bit on the distance between the points.
    The halfsine and cosine functions use a constant average (6371000.0m) for the earth radius, and give a good approximation over (very) long distances.
    Depending on your location on the globe the number of meters per degree (lat long) is not constant.
    That's where datum conversions (UTM) comes in handy.
    For smaller distances, where all points are in the same UTM zone, I would convert all (lat long) into easting/northings, and use Pythagoras' theorem to calculate both the distance and the bearing.

  10. #10
    Registered User michalj's Avatar
    Join Date
    Jan 2012
    Posts
    1
    Hi,

    You can try to use my code.

    I have placed it sometime ago on my blog - link to distance between two GPS points

    I hope it will be useful for you.

    Best regards,
    Michał

  11. #11
    Registered User dtorrent's Avatar
    Join Date
    Mar 2010
    Posts
    9
    Thanks for your link, I'm going to check it next week.

Similar Threads

  1. converting coordinates in pixel -> m3g coordinates
    By Kayron in forum Mobile Java General
    Replies: 0
    Last Post: 2011-02-27, 21:33
  2. Set focus to a particular distance
    By jp19 in forum Symbian C++
    Replies: 9
    Last Post: 2011-01-25, 13:09
  3. How to use jsr 179 distance method?
    By kalki in forum Mobile Java General
    Replies: 3
    Last Post: 2010-04-05, 05:20
  4. Coordinates.distance() question
    By hardc0d3r in forum Mobile Java General
    Replies: 3
    Last Post: 2007-10-18, 01:56
  5. Getting Ir distance
    By prakashforum in forum Mobile Java General
    Replies: 1
    Last Post: 2007-08-01, 12:39

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved