locked
GetGeopositionAsync always returns the EXACT same Lattitude and Longitude RRS feed

  • Question

  • When ever I try to get my current coordinates using GetPositionAsync I always get the EXACT same long and lat.  I originally thought it had to do with the MaximumAge property, but even when setting it to 1ms it doesn't change.

    A little bit of background:

    1) I am using a MAC running iOS with parallels and developing on a Windows8 image (I suspect this is the issue)

    2) I originally built the application at my home office and the coordinates that came up were about 1 mi. west of where I was, so I assumed it was an accuracy issue.  I then continued working on it at my office which is about 10 mi. away and that's when I noticed I was getting the EXACT same long and lat as before.  At that point I suspected it was an issue with caching the location somehow, so I even went ahead and created a brand new application and was getting the same location info there too.

    below is the code I am using:

    Geolocator gl = new Geolocator();
    gl.DesiredAccuracy = PositionAccuracy.High;
    try
    {
        Geoposition position = await gl.GetGeopositionAsync(TimeSpan.FromMilliseconds(1), TimeSpan.FromMilliseconds(1));
        tbLat.Text = "Lat: " + position.Coordinate.Latitude.ToString();
        tbLong.Text = "Long: " + position.Coordinate.Longitude.ToString();

    }
    catch (Exception ex)
    {
        tbLat.Text = "Error" + ex.ToString();
    }
    finally
    {
    }

     Any help would be appreciated.

    Friday, March 15, 2013 11:56 AM

Answers

  • Again, thanks for your reply. 

    A few updates:

    1) So I checked what my current location is on the Bing Maps App on my virtual machine and it says I am in that EXACT same location I keep getting over and over.

    2) I went ahead and navigated to bing.com/maps on my vm and again that too returned the EXACT same location I keep getting over and over.

    3) I went ahead and navigated to bing.com/maps on my actual MAC (FireFox) but that returned the CORRECT address

    4) Finally, I got a hold of a Windows8 tablet (a surface) and the bing maps app returns the CORRECT address.

    I think it absolutely has something to do with developing on a VM using parallesls.

    -Barak

    • Proposed as answer by Jesse Jiang Monday, March 18, 2013 6:23 AM
    • Marked as answer by Jesse Jiang Wednesday, March 20, 2013 2:31 AM
    Friday, March 15, 2013 3:55 PM

All replies

  • See what the Maps app thinks your location is.

    Location determination on a non-GPS equipped PC is always suspect and dependent on the data from a location service provider using IP addresses (or nearby WiFi IDs on non-cell phone wireless devices) and a database.  My location as reported by the Windows Maps app on my PC is off by at least 10 miles.  It is not surprising that you see no change after moving 1 mile without GPS.


    • Edited by jrboddie Friday, March 15, 2013 12:44 PM grammar
    Friday, March 15, 2013 12:43 PM
  • Thanks for the reply jrboddie, however two things:

    1) I have developed HTML5 applications with similar functionality, on the same MAC (at the same location even :)) and had much more exact coordinates.

    2) I get the EXACT same Lat/Long when I run the code from my two offices (10 mi. apart).  I can understand that they would be off at both locations, but getting the EXACT same Lat/Long anywhere I run the app seems like I have something set up incorrectly.

    Any thoughts?

    Friday, March 15, 2013 12:51 PM
  • It could be a caching issue, but I am not impressed with the Microsoft location service that is used when there is no GPS.

    If your HTML5 application used the Google Maps API, for example, it would have used a different, and possibly more detailed/accurate) database than what is used by the Windows apps location service (Bing).

    Again, open the Bing Maps App on your Start Screen, open the apps bar and check your location.


    ETA: I just checked my Maps App location on my Mac/Bootcamp and got a very accurate result.  The Mac is connected via WiFi and the service can use that database to get a better fix than it can on my desktop machine which is connected to the internet through the LAN port.  Is your Mac using WiFi or direct connect to the internet?
    • Edited by jrboddie Friday, March 15, 2013 1:20 PM
    Friday, March 15, 2013 1:03 PM
  • Again, thanks for your reply. 

    A few updates:

    1) So I checked what my current location is on the Bing Maps App on my virtual machine and it says I am in that EXACT same location I keep getting over and over.

    2) I went ahead and navigated to bing.com/maps on my vm and again that too returned the EXACT same location I keep getting over and over.

    3) I went ahead and navigated to bing.com/maps on my actual MAC (FireFox) but that returned the CORRECT address

    4) Finally, I got a hold of a Windows8 tablet (a surface) and the bing maps app returns the CORRECT address.

    I think it absolutely has something to do with developing on a VM using parallesls.

    -Barak

    • Proposed as answer by Jesse Jiang Monday, March 18, 2013 6:23 AM
    • Marked as answer by Jesse Jiang Wednesday, March 20, 2013 2:31 AM
    Friday, March 15, 2013 3:55 PM