O'Reilly logo

iPhone JavaScript Cookbook by Arturo Fernandez Montoro

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Calculating distances between two points

In this chapter, we've already leaned how to find out our current location and how to pinpoint it on Google Maps. A step further could be to calculate the distance between two points. For getting these points, we can use the two different points through the current location. This means that we'll need to change the physical location of our iPhone.

For this recipe, we're going to develop a simple application, which captures two points and displays the distance between them. Although this recipe is very simple, you can extend its functionality by adjusting it to your requirements. For example, you can write an application that receives two points from a widget. In this case, the user can type the data for ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required