how to calculate distance,speed,calaries b/w two geopoints

Put problem concerning MapActivities, MapViews, Overlays and GPS in this forum.

how to calculate distance,speed,calaries b/w two geopoints

Postby V.S.Rao » Thu May 06, 2010 5:07 pm

hi all..

I want to calculate distance between two geopoints, speed of moving,how many calories while moving with this speed.

I may not calculate all these... plz help me...
V.S.Rao
V.S.Rao
Freshman
Freshman
 
Posts: 7
Joined: Wed May 05, 2010 5:48 am
Location: Hyderabad

Top

Postby kekomal » Fri May 07, 2010 7:48 am

What's exactly the problem with every of these points? Or do you want somebody else to do the work for you? Have you searched in the forum or asked Google before?

Be more explicit, please.
kekomal
Junior Developer
Junior Developer
 
Posts: 19
Joined: Wed Mar 17, 2010 10:44 am
Location: Bilbao, Spain

Postby V.S.Rao » Fri May 07, 2010 10:37 am

I have two geopoints. In between these two points I need to calculate distance First.

Speed: If We pass in train or by walking how much speed we travels?

Calories: How many calories are take for travel some distance with speed while walking.

For this I calculate present location geopoint and destination geopoint saved in database.

I need the procedure or formula for all these calculations...

plz help me..
V.S.Rao
V.S.Rao
Freshman
Freshman
 
Posts: 7
Joined: Wed May 05, 2010 5:48 am
Location: Hyderabad

Postby kekomal » Fri May 07, 2010 11:29 am

DISTANCE:

For every GeoPoint:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. Location location = new Location("gps");
  2. location.setLatitude(geoPoint.getLatitudeE6() / 1E6);
  3. location.setLongitude(geoPoint.getLongitudeE6() / 1E6);
Parsed in 0.030 seconds, using GeSHi 1.0.8.4

...and then...
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. float distance = location.distanceTo(otherLocation);
Parsed in 0.030 seconds, using GeSHi 1.0.8.4


If you wanna get the route, here you have an example:
http://csie-tw.blogspot.com/2009/06/android-driving-direction-route-path.html
...then you can iterate through points, get the distance between them and sum.

FOR CALCULATING SPEED:
Use Location API. An example:
http://marakana.com/forums/android/android_examples/42.html
...and, for instance, in the callback onLocationChanged() get the System time (SystemClock.uptimeMillis()) and calculate. You'll probably need to smooth your calculations to avoid peaks.

CALORIES:
Ask Google or on a sports forum, no in an Android forum. A simple Google search returns you results as:
http://www.livestrong.com/article/111930-calculate-calories-burned/
kekomal
Junior Developer
Junior Developer
 
Posts: 19
Joined: Wed Mar 17, 2010 10:44 am
Location: Bilbao, Spain

Postby V.S.Rao » Fri May 07, 2010 1:16 pm

Thank You Very Much...

Just now I calculate the distance in Km. So, I can easily calculate the speed also.
V.S.Rao
V.S.Rao
Freshman
Freshman
 
Posts: 7
Joined: Wed May 05, 2010 5:48 am
Location: Hyderabad

Top

Return to Map Problems

Who is online

Users browsing this forum: No registered users and 2 guests