Tutorial 5: Using Location & GPS

Follow

Comments

16 comments

  • Avatar
    cameronford

    how do you add a text box to connect to the map so you can type in a address and it will show you
     

  • Avatar
    cameronford

    the way

  • Avatar
    ben

    Hello Cameronford,

     I'm not quite sure what you mean? Do you want to have this text box while you are working on your app or while a user is using you app? If you want it while you are working on your app then it's already there near the top of your screen. If you want to have this as a feature within your app then I'm afraid it's not something that we offer at this time. 

    Thanks

  • Avatar
    Chrisol

    Is there a standard java script for playing audio files when or for associated images to appear when the user in is a hotspot?

  • Avatar
    marcoliocops

    on the location page there is a move in function for each point. that function points to a function in your code. if the function in your code requires an argument how do you include this argument on the location page. example the function in the code side is "function onWalkIntoGPS(data)" on the location tab one should be able to specify onWalkIntoGPS(3). but only onWalkIntoGPS works.... so........

  • Avatar
    wiltshirevehicle

    I want to simply have a map on one of my pages which shows the location of the user. How do I go about this?

  • Avatar
    kieron

    Hi wiltshirevehicle,

    You can use the Map widget in the Layout tab, and make sure "trackUser" is checked (it is by default) - and make sure that in the App Details popup window (where you can add publishing information) has the "GPS Enabled" checkbox ticked too (which is also default). Your user's location will be marked by a grey person icon.

    Hope that helps

  • Avatar
    wiltshirevehicle

    That's great, thanks!

  • Avatar
    egw_giota

    helloo... I want to know if it possible for the app to get user's current location

  • Avatar
    kieron

    Hi,

    Yes, you can - just use the getLastLocation function: http://the.appfurnace.com/docs/cordova_locationsensor_locationSensor.md.html#getLastLocation

    It returns an object with x and y co-ordinates that you can use:

    var latlng = af.locationSensor.getLastLocation();
    var lat = latlng.y;
    var lng = latlng.x;
    var datum = latlng.datum;


    Hope that helps

  • Avatar
    linkum

    Hello,I am facing issues placing my zones/areas in the right locations. I took coordinates of the locations and I am having difficulties moving my cursor along with the coordinate bar on the side. Is there another way to place my areas accurately? 

    P.S. The place I am working with does not have streets or addresses. 

  • Avatar
    kieron

    Hi linkum,

    You can add zones in code, like so:

    var zone = new af.Zone("myZone", [
    new af.Coord(-2.5818, 51.4426),
    new af.Coord(-2.5818, 51.4584),
    new af.Coord(-2.6072, 51.45844),
    new af.Coord(-2.6072, 51.4426)
    ]);
    af.geoFeatures.addFeature(zone);

    You'll need to specify co-ordinates for each node (corner) of the zone this way. There's more information in the API here: http://the.appfurnace.com/docs/cordova_zone_zone.md.html#Zone

    Of course, if you're working with points, this code is easier:

    var point = new af.Point("mypoint", new af.Coord(-2.45, 51.4), 20);
    af
    .geoFeatures.addFeature(point);

    http://the.appfurnace.com/docs/cordova_point_point.md.html#Point )

    As a side note, if your geo features are situated in a remote area (just a guess, based on the lack of streets in your question), you may want to rely more on testing the app on-location, rather than the co-ordinates, as remote areas tend to be less reliable with GPS - so you might need larger, less complicated shapes as areas than expected - so you might be able to be less precise in your placement.

    Hope that helps

  • Avatar
    linkum

    Hi Kieron,

    your comment was helpful. However, I am still having issues. The problem is that when I measure coordinates with two different GPS devices (I get the same result), it does not match with the coordinates presented on the map in Appfurnace. Is it plausible that the GPS and appfurnace map coordinates bar are not in sync? 

    So, if I cannot rely on the coordinates, is my best bet to place it by eye and test it?

  • Avatar
    kieron

    Hi linkum,

    Could you provide an example of the co-ordinates differing? It'll give us a sense of what kind of difference you're seeing

  • Avatar
    linkum

    Hi there,

    Can I ask whether a 20 metre size for points is still the recommended minimum? ~ Our app will be used in a wilderness area on a coast.  thanks.

  • Avatar
    kieron

    Hi,

    We recommend 20m as a minimum point size, which we've found is a good average to stick to, that avoids a lot of GPS flicker. However, GPS coverage and reliability does vary from place to place, so we'd suggest testing your locations with the AppFurnace Player app - and seeing what size works best for your app. In my experience, coastal areas can be more unreliable, so we've had to make areas bigger than the usual to ensure a smooth experience, but it's always worth testing yourself.

    Hope that helps.

Please sign in to leave a comment.

Powered by Zendesk