Is a realtime gps jQuery mobile possible?

Asked By 10 points N/A Posted on -
qa-featured

Hi! Just a curious newbie here. I am proposing a project on our current course and want to deal with jquery incorporated as gps. I don't know if I sound right, but I just want to ask if a realtime gps jquery mobile is possible to program? And what are the necessary things I should have to look after and consider? Thank you very much for your support.

SHARE
Best Answer by Larson Salmeron
Best Answer
Best Answer
Answered By 0 points N/A #142382

Is a realtime gps jQuery mobile possible?

qa-featured

Realtime GPS jQuery Mobile is possible. HTML5 (the latest HTML version) is the standard for jQuery Mobile. You should and learn HTML5 since it's what need. navigator.geolocaton object cause GPS to be available.

 

Lewis, use this code for longitude and latitude.

 

<!DOCTYPE html> 
<html> 
<head> 
  <meta name=viewport content="user-scalable=no,width=device-width" />
  <link rel=stylesheet href=jquery.mobile/jquery.mobile.css />
  <script src=jquery.js></script>
  <script src=jquery.mobile/jquery.mobile.js></script>
</head> 
 
<body> 
 
<div data-role=page id=home>
  <div data-role=header>
    <h1>Home</h1>
  </div>
 
  <div data-role=content>
    <span> Latitude : </span> <span id=lat></span> <br />
    <span> Longitude : </span> <span id=lng></span> <br />
  </div>
</div>
 
</body>
</html>
 
<script>
 
navigator.geolocation.getCurrentPosition (function (pos)
{
  var lat = pos.coords.latitude;
  var lng = pos.coords.longitude;
  $("#lat").text (lat);
  $("#lng").text (lng);
});
 
</script>

 

 

Answered By 0 points N/A #198314

Is a realtime gps jQuery mobile possible?

qa-featured

Hello!

It is possible to create a jquery GPS for mobile phone, but it may take you some time.

You can use this script for the GPS part:

(function($) {
        $.gps = {
                approximate:function(loc1, loc2, success)
                {
                        x = 69.1 * (loc2.latitude loc1.latitude);
                        y = 53.0 * (loc2.longitude loc1.longitude);
 
                        mi = Math.sqrt(x * x + y * y);
                        success(mi);
                },                
                distance:function(loc1, loc2, success)
                {
                        mi = (3963 * 3.1415926 * Math.sqrt(
                                (loc2.latitudeloc1.latitude) *
                                (loc2.latitudeloc1.latitude) +
                                Math.cos(loc2.latitude/57.29578) *
                                Math.cos(loc1.latitude/57.29578) *
                                (loc2.longitudeloc1.longitude) *
                                (loc2.longitudeloc1.longitude)
                        )/180);
 
                        success(mi);
                },
                /* not 100% sure this works properly, just yet */
                minMaxRadii:function(loc, mi, success)
                {
                        lat_mile = 0.0144839 * mi;
                        lon_mile = (0.0144839 / Math.cos(loc.latitude * 3.1415926 / 180 )) * mi;
 
                        var range = {
                                max: {
                                        latitude: loc.latitude + lat_mile,
                                        longitude: loc.longitude + lon_mile
                                },
                                min: {
                                        latitude: loc.latitude lat_mile,
                                        longitude: loc.longitude lon_mile
                                }
                        }
 
                        success(range);
                },
                km2mi:function(km){ return km * 0.621371192; },
                mi2km:function(mi){ return mi * 1.609344; }
        }
})(jQuery);
 
It also depends on what programming language you would like to use and on what kind of phone you want to use it.
 
After creating the software, you should use something like this: Location Site
 
To help you get the needed locations.
 
Good luck!
 
 
 
 
 
 

 

Login/Register to Answer

Related Questions