Journey Recording using GPS Tracking
Hello! Working on it, but there are no news yet..
Catch up wih the Appery.io community on our forum. Here you'll find information on the lastest questions and issues Appery.io developers are discussing.
https://forum.appery.io/
Hello! Working on it, but there are no news yet..
Joe, you didn't change code as we suggested a few times above. You have to replace prepoints.push([(coordsArray{i}.time - startTime) / 1000 / 60, coordsArray.alt]);/pre with prepoints.push([(coordsArray.time - startTime) / 1000 / 60, coordsArray.alt]);/pre
Just to remind that custom JS code is outside the scope of our support. You must debug your custom code http://docs.appery.io/documentation/d...
Hello! Google Chrome doesn't have GPS - it returns ones current position and after that doesn't refresh coordinates. That's why coordinates array is empty.
That's what I assumed, but I'm not sure how else to debug the app without Chrome. What's the next step? Look for errors in logcat in Eclipse? Or check for errors in jslint/jshint? Thanks Maryna!
Hi Joe,
1) jslint/jshint - doesn't display errors
2) Look for errors in logcat - is a possible option
3) You can test dummy data where it's possible. For example, on 'result' page read data not from localStorage variable, but paste a row with data in needed format. You can replace the following page codevar coordsArray = JSON.parse(localStorage.getItem("coordsArray"));/codewith:codevar coordsArray = JSON.parse('......');/code
where replace '......' with data in format you need them in localStorage.
Good news! The average speed graph on the results page displays the data, and the second graph for altitude displays nothing. This is progress! If I recall, we never set up the local storage variable for the altitude data to be displayed or stored. So would that be something like adding this to geolocation success? code
Appery("altitude").text("Altitude: ft");/code
after code else {
Appery("avrSpeedLabel").text("Average speed: 0 m/h");
} /code
Do I need to change or add to any of the geolocation service mapping displayed below?
It's been a long time since we've set up the localStorage for the "Coordsarray" variable, what needs to happen for the "altitude" label on the "recordride" page, and for "plot2" to populate on the "results" page?
Thank you so very much for your help. I believe this project will be mostly finished after this major milestone!
Hello! Please take a look at this reply https://getsatisfaction.com/apperyio/...
Does that mean to removecodeAppery("altitude").text("Altitude: ft");/code?
My geolocation success event has the following code:codeAppery("errorLabel").hide();
invokeTimes++;
Appery("dataLabel").html('Latitude: ' + data.coords.latitude + '<br>' +
'Longitude: ' + data.coords.longitude + '<br>' +
'Altitude: ' + data.coords.altitude + '<br>' +
'Accuracy: ' + data.coords.accuracy + '<br>' +
'Timestamp: ' + data.timestamp + '<br>');
if(!paused) {
if(oldTime != 0) {
var dist = findDistance(oldLat, oldLng, data.coords.latitude, data.coords.longitude);
totalDist += dist;
totalTime += data.timestamp - oldTime;
}
oldTime = data.timestamp;
oldLat = data.coords.latitude;
oldLng = data.coords.longitude;
Appery("totalDistLabel").text("Distance: " + round(totalDist) + 'm');
Appery("totalTimeLabel").text("Time: " + mSecToTime(totalTime));
if (totalTime>0) {
Appery("avrSpeedLabel").text("Average speed: " + round(totalDist/(totalTime/(1000*3600))) + " m/h");
} else {
Appery("avrSpeedLabel").text("Average speed: 0 m/h");
}
var coordsArray = [];
try {
coordsArray = JSON.parse(localStorage.getItem("coordsArray"));
if ({}.toString.call(coordsArray) !== "[object Array]") {
coordsArray = [];
}
}catch ( e ){
coordsArray = [];
}
var speed = totalTime!=0 ? round(totalDist/(totalTime/(1000*3600))) : 0;
var timeStamp = new Date(data.timestamp).getTime();
coordsArray.push({'time': timeStamp, 'lat': data.coords.latitude, 'lng': data.coords.longitude, 'speed': speed});
localStorage.setItem("coordsArray", JSON.stringify(coordsArray));
}
updateMarker(data.coords.latitude, data.coords.longitude);
coordsArray.push({'time': timeStamp, 'lat': data.coords.latitude, 'lng': data.coords.longitude, 'alt': data.coords.altitude, 'speed': speed});/code And I think I'm getting this in logcat:
That's about where I click "view ride data." When I click, nothing happens. I don't navigate to "results" page. Did I add something incorrectly?
Hello! Sorry for delay. We're working on it.