Does anyone know how to process the overview_polyline data returned by Google Maps API?

With help from the Thunkable community I am processing the standard google JSON response of latitudes and longitudes without any problems. THe only issue I have is with the quality of the data points provided. Having contacted Google they admit the data is limited and this results in polylines drawn on the map that do not always line up with roads I am expecting my drivers to follow. Occasionally it takes them off road or across lakes!
As part of their JSON response, google also supply something called and overview polyline. They tell me this is a more “smoothed” and detailed set of points and I would like to try using this data to see if it is more suitable for my project. I have some sample data and it looks like this.

“overview_polyline” : {
“points” : “{~qzH_buAKNO^\ZfBfBpApAfCjCpEbFdFpFhEbFpBjCClCpCtChFzEzDpDfBrBt@hAr@tAt@rBv@Db@fDT~CHhANhATAL\\NN\\LVAJBHJBDl@^nA^xA@h@R@MLOHAFBFJBPAPGNIFGv@?j@NxDh@|KRtIKb@b@tM^bFRxBv@dGj@bD@lBjAxEr@zBt@xBxAnDlBtDv@tAhAdBx@fABnBzBvBxIIhC|BfEtDnQPbJIfIpH|B|B~@fAbBhCfApBr@bBp@lBp@zB^vAp@nDZhC\\bEJtBDzBBpC?|KFlFL~BRfCj@~Dh@fCVdAd@Bj@~ABjDh@~@nAbBbEfF|FHfKbLfAdA~B|BpEtE~AzApApA~HjHzCnC|ArAvGrFhNhLrUpRpE~DdCfCxBfCtCEtGKfGzJpJ~OlBhDh@bAXp@NJFDHTx@dCAbEj@pDZvCR|CZdJATJT^Xj@|@b@d@|@vAjBrD~@xC@rBRhBNxAJfDBdCFvDRBVpARv@b@bArAtCtEfKxBpEEhGnCrEx@mAJUHa@FmAPmHLyAPeBTsA\gAvAoBdAcAPCh@AZEx@}@JCZBtC`AxACbASP?H@BEBYCMmAgBiDyEmAqB]{@E[Ay@ZuCBs@Aa@IeAs@}BmCiI”
}
IF you are familiar with this sort of data or have worked with it before I would be delighted to hear from you.

1 Like

Google encodes the poly lines in a single string. You need to decode it first to be able to read the contents.

1 Like

Thanks muneer. I got that bit. Having read how Google encode this data I thought I would see if anyone else had managed this as it looks like a huge bit of work and I am not sure I have the skills to do it. Still perhaps I will have to take a go at it.

1 Like