I have polyline data in mysql. I want to measure its length in php. I have looked distance matrix api. But it requests origin_addresses and destination_addresses , i haven't got those values.
I found decodePolylineToArray gist but when i decode my polyline, there are a lot of values. How can i measure length of polyline? I am using php but if you have a method in another language, i can port it to php.
You need to use Haversine's formula for every Path in the polyline: http://en.wikipedia.org/wiki/Haversine_formula
For different programming languages search for : https://www.google.ch/search?q=php+haversine+formula&aq=0&oq=php+Haversine&aqs=chrome.1.57j0l3j62l2.8586&sourceid=chrome&ie=UTF-8
This is a good sample for manual calculation in JS Calculate distance between two points in google maps V3, but there is a simpler way:
google.maps.geometry.spherical.computeDistanceBetween(path.getAt(i), path.getAt(i+1));
Check out this sample: http://www-users.mat.umk.pl/~kaskader/polyline_simple.html that uses it.
HTH