Getting The Latitude And Longitude Of The Point In Between (by Percentage) Two Points On Google Maps Js Api?
Here is the code I have so far: function initialize() { var mapOptions = { center: { lat: 21.9072222, lng: -47.715}, zoom: 3 }; var map = new google.maps.Map(document
Solution 1:
As suggested by @Dr.Molle load the geometry
library and use the method interpolate
.
var startPoint = new google.maps.LatLng(53.9834124, -1.5863153);
var endPoint = new google.maps.LatLng(-12.0553442, -77.0451853);
var percentage = 0.5;
var middlePoint = new google.maps.geometry.spherical.interpolate(startPoint, endPoint, percentage);
Post a Comment for "Getting The Latitude And Longitude Of The Point In Between (by Percentage) Two Points On Google Maps Js Api?"