Time for action – getting the distance from a coordinate
This example will compute the distance you would have to travel either south or north to get to the equator. The example is in miles for those of you reading in metric!
This example is available for download or browse at https://github.com/myleftboot/Chapter-7-Geo. Perform the following steps to get the distance from a coordinate:
Create a new blank mobile app by clicking on File | New | Titanium Project. Don't use a template as it will just generate code that gets in the way.
Create the window for the app:
var win1 = Titanium.UI.createWindow({ backgroundColor:'#fff' });
Add a function that does the hard work of computing the distance across the earth's surface between two coordinates on the surface:
function distanceinM(_args) { // ---- extend Number object with methods for converting degrees/radians /** Converts numeric degrees to radians */ if (typeof(Number.prototype.toRad) === "undefined") { Number.prototype...