Skip to Main Content
PhoneGap Build
book

PhoneGap Build

by Bintu Harwani
November 2013
Intermediate to advanced content levelIntermediate to advanced
303 pages
8h 45m
English
Auerbach Publications
Content preview from PhoneGap Build
Using PhoneGap API ◾  217
var line = new google.maps.Polyline({
path: [marker1.getPosition(), marker2.getPosition()],
strokeColor: '#FF0000',
strokeOpacity: 1.0,
map: map
});
Note: e map property is essential in Polyline and other drawing classes because it defines the
map object on which the line has to be drawn.
Finding the Distance between Two Positions
To find out the distance between two position objects, the computeDistanceBetween()
method is used, as shown in the statements below:
var p1 = new google.maps.LatLng(latitude_value1, longitude_value1);
var p2 = new google.maps.LatLng(latitude_value2, longitude_value2);
d = google.maps.geometry.spherical.computeDistanceBetween(p1, p2);
We can see that positions, that is, LatLng instances, p1 and
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Beginning App Development with Parse and Phonegap

Beginning App Development with Parse and Phonegap

Wilkins Fernandez, Stephan Alber
Ajax For Dummies®

Ajax For Dummies®

PhD Steve Holzner

Publisher Resources

ISBN: 9781466589742