facebook

How to get geolocation data to the device W/O maps

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 10 posts - 16 through 25 (of 25 total)
  • Author
    Posts
  • #341646 Reply

    SKnoxmn
    Member

    Stu,

    Does your Altitude work? I was going t hrough adding Altitude from the geolocation functions and its returning 150.

    I am in a building right now, but I dont think anywhere in Minnesota is under about 600 ASL. Would you know if the geolocation functions are for AGL or ASL?

    I liked to get my altitude above sea level, in order to get baro pressure (Adjusted for Altitude)

    Any guidance is appreciated,
    SKnox

    #341647 Reply

    Stu Wade
    Member

    Hi,

    Yes, in as much as it returns a very approximate value (the altitude, I mean). You will have to thank your DoD for the manky accuracy. As far as AGL or ASL, I don’t know off hand, but I guess it is a matter of record somewhere. You have noticed that amongst the various returns from geolocation are the ‘accuracy’ figures for position and altitude? In my locale (Liverpool, UK) the location accuracy is 65metres and the altitude accuracy 10metres … and as an afterthought, I believe the altitude figure is itself in metres (again a matter of record somewhere) which might go somewhere towards resolving your problem, if, as I am assuming, you are used to working in feet.

    Regards, Stu

    #341648 Reply

    SKnoxmn
    Member

    Yes, I just checked a few things on this side and it does seem to be in meters ASL. and accurate to within about 10m is more than accurate enough for what I’m trying to do with it.

    I did have a question on your script, seems that it is calculating heading? Is that based on one location and then moving to another in order to get which way you are moving? Or is it an actual heading more along the lines of Azimuth?

    Would you happen to know how they define azimuth, bearing, heading…? I’l be looking to capture the direction my phone is pointing at some point.

    SKnox

    #341651 Reply

    Stu Wade
    Member

    Yes — I too have just checked the standard http://dev.w3.org/geo/api/spec-source.html which is quite comprehensive – the altitude ‘should’ be (I have no idea whether the implementation adheres to the standard) metres above the spheroid. My testbed does not calculate heading or speed it simply reads them from the geolocation return – the only real calculation it does is obtain the distance between two sets of lat/long pairs in metres – I believe the calculation is good for a distance of a few km.

    #341652 Reply

    Stu Wade
    Member

    … and for the direction your phone is pointing try :

    navigator.compass.getCurrentHeading

    full spec here http://docs.phonegap.com/en/1.0.0/phonegap_compass_compass.md.html

    I have yet to try this myself, but I guess it works given the number of compass Apps out there.

    #341655 Reply

    SKnoxmn
    Member

    I was just there reading over that one.

    Will I then create a “function” to:
    Function getCurrentHeading()
    {
    navigator.compass.getCurrentHeading(compassSuccess, compassError, compassOptions);
    }

    then:
    function onSuccess(Heading)
    {
    $(‘#m1-Location-textField4’).val(navigator.compass.heading);
    }

    Am I even in the right neighborhood with any of this? Im thinking I would add this to the Custom_js

    #341656 Reply

    Stu Wade
    Member

    Definitely the right ball-park, but the details are flaky – and sadly, in programming, the devil really is in the details…

    
    function getCurrentHeading()
    {
    navigator.compass.getCurrentHeading(compassSuccess, compassError);
    }
    
    function compassSuccess(heading) // function name MUST match that given above
    {
    $('#m1-Location-textField4').val(heading);
    }
    
    function compassError()
    {
    // any error action you might like
    }
    

    should, i hope, work for you

    and, yes all the above goes in the _custom.js file and you will perhaps need a button containing something like

    return getCurrentHeading();

    #341659 Reply

    SKnoxmn
    Member

    I was afraid of that…

    I was hoping that I could put it in the same On Click function of “return findPosition();”

    Thanks again from this side of the pond.

    SKnox

    #341661 Reply

    Stu Wade
    Member

    You can, if that’s the way you want to play it ….

    button says: return doMyStuff();

    function doMyStuff()
    {
    findPosition();
    getCurrentHeading();
    ) // goes in custom.js

    #341662 Reply

    SKnoxmn
    Member

    I’m still poking around over here trying to get it to return the heading to “textField4”

    But hey! I’m learning a ton of stuff by playing with this and going through some trial and error. totally worth the cost of License.

    SKnox

Viewing 10 posts - 16 through 25 (of 25 total)
Reply To: How to get geolocation data to the device W/O maps

You must be logged in to post in the forum log in