Start a new topic

How I get my location in javascript by phonegap and calculate the distance

How I get my location in javascript by phonegap and calculate the distance


not wikitude related answer but it is easy job, you get location with phonegap geolocation plugin:

http://docs.phonegap.com/en/3.0.0/cordova_geolocation_geolocation.md.html#Geolocation

you calculate the distance between 2 locations can be done by converting them in metric coordinate system from lat,lon. You can use google's (900913)

then calculating the distance between 2 points is:

point1(x1,y1) , point2(x2,y2)

distance=sqrt((x1-x2)^2+(y1-y2)^2)

 

How I get my location in javascript by phonegap and calculate the distance between my location and my destination.
Login or Signup to post a comment