Joe Paisley
Posts: 0
Joined: Thu Mar 14, 2013 8:41 pm

Journey Recording using GPS Tracking

Would I add some code like this on the "jplot" page show, and simply change the label names in both the javascript and the names and coordinate the names of the labels with the javascript?

code
Appery("totalDistLabel1").text("Distance: " + round(totalDist) + ' km');
Appery("totalTimeLabel1").text("Time: " + mSecToTime(totalTime));
if (totalTime>0) {
Appery("avrSpeedLabel1").text("Average speed: " + round(totalDist/(totalTime/(1000*3600))) + " km/h");
} else {
Appery("avrSpeedLabel1").text("Average speed: 0 km/h");
}
}
/code

When I looked back on the javascript, I couldn't find where there was any mention of "altitude" in the javascript, and so the altitude value has never populated in the "altitude" label on the "recordride" page.

How could I go about putting the localStorage altitude data into a jplot graph too?

Thanks!

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Journey Recording using GPS Tracking

Hello!
1) You don't use altitude in your code. If you want to use it to calculate speed you need to change code of distance calculation taking into account altitude, but it should be coded by you. You would need to search for more information online.
2) when you navigate to plot page from record ride page you should save to local storage variables label's valuescodelocalStorage.setItem('someName', Appery('labelName').text());/code
on plot page on Show event put that saved values to labels:
codeAppery("labelName").text(localStorage.getItem('someName'));/code

Joe Paisley
Posts: 0
Joined: Thu Mar 14, 2013 8:41 pm

Journey Recording using GPS Tracking

Thanks Marina! I'll try that code and report back with results. In the meantime, do you recommend any online resources to help me get started coding the altitude jplot line graph? I thought the altitude data was already being stored in localStorage?

Joe Paisley
Posts: 0
Joined: Thu Mar 14, 2013 8:41 pm

Journey Recording using GPS Tracking

Thanks Marina! I'll try that code and report back with results. In the meantime, do you recommend any online resources to help me get started coding the altitude jplot line graph? I thought the altitude data was already being stored in localStorage?

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Journey Recording using GPS Tracking

Sorry, don't have any link to help you.

Joe Paisley
Posts: 0
Joined: Thu Mar 14, 2013 8:41 pm

Journey Recording using GPS Tracking

I'm unsure of how to use the Google Maps API service to render elevation data in the "altitude" label. Have I mapped the data correctly here?

Image

To call upon the data, which I thought was stored in local storage, do I add a line of code on the "recordride" page show event along the lines of:

code
localStorage.altitude('altitude', Appery("altitude").text("Altitude: " + data.coords.elevation));/code in geolocation success and

codeAppery("altitude").text(localStorage.getItem('altitude'));/code

Will this give me data in the "altitude" label?

And how do I get the altitude data to graph in "panel_3" component on the "plot" page?

I'm very confused on how to do all of this. Can I simply copy the code on the "recordride" page and change the label names to redisplay the same data in different labels on the "plot" page with code like this?

codeAppery("errorLabel1").hide();
invokeTimes++;
Appery("dataLabel")&#46;html('Latitude: ' + data&#46;coords&#46;latitude + '<br>' +
'Longitude: ' + data&#46;coords&#46;longitude + '<br>' +
'Altitude: ' + data&#46;coords&#46;altitude + '<br>' +
'Accuracy: ' + data&#46;coords&#46;accuracy + '<br>' +
'Timestamp: ' + data&#46;timestamp + '<br>');
if(!paused) {
if(oldTime != 0) {
var dist = findDistance(oldLat, oldLng, data&#46;coords&#46;latitude, data&#46;coords&#46;longitude);
totalDist += dist;
totalTime += data&#46;timestamp - oldTime;
}
oldTime = data&#46;timestamp;
oldLat = data&#46;coords&#46;latitude;
oldLng = data&#46;coords&#46;longitude;
Appery("totalDistLabel1")&#46;text("Distance: " + round(totalDist) + 'm');
Appery("totalTimeLabel1")&#46;text("Time: " + mSecToTime(totalTime));
if (totalTime>0) {
Appery("avrSpeedLabel1")&#46;text("Average speed: " + round(totalDist&#47;(totalTime&#47;(1000*3600))) + " m&#47;h");
} else {
Appery("avrSpeedLabel1")&#46;text("Average speed: 0 m&#47;h");
}
/code

Please clarify! Thanks for your help!

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Journey Recording using GPS Tracking

Dear Joe!

Unfortunately, the support team is not able to check your guesses for you every time. Please check them out yourself. This discussion has been shown many mechanisms of debugging and research. Also, we can not recount here the documentation for the third-party libraries that are available in the public domain.

Support team resolve issues and difficulties in the platform Appery.io, but not a problem in the user apps logic. App development involves having certain knowledge and understanding of the process of development and debugging.

Joe Paisley
Posts: 0
Joined: Thu Mar 14, 2013 8:41 pm

Journey Recording using GPS Tracking

If the sort of assistance I've been receiving is outside of the domain of Appery support, I misunderstood the purpose of this discussion forum.

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Journey Recording using GPS Tracking

We are here to help, we just can't do everything for you. If something is not working as expected we long to help.

Joe Paisley
Posts: 0
Joined: Thu Mar 14, 2013 8:41 pm

Journey Recording using GPS Tracking

I have recently modified the "recordride" page to include the jplot chart and the Twitter and Facebook buttons. I'm still trying to figure out how to include an elevation chart, but now whatever I have done to my app, it will not navigate to any page from the starting "website" page. What have I managed to mess up? Image

Return to “Issues”