NEW UPDATE! PolylineTools extension

NEW UPDATE: New function to encode into a string a list with paired latitude and longitude!

Hello Thunkers! Here I present to you my first extension ever made for decoding and encoding polylines from Google Maps API. First, I found the Encoding Polyline Algorithm Format and tried to reverse it using blocks, but then I found the Jeffrey Sambells’ method and I felt like learning how to make an extension.

So this is it! I hope you find this useful and if you find how to make it better, please let me know so I can learn from it.

This extension was made in colaboration with Diego Pedroza.

Tool developed by Carlos Pedroza to decode and encode Polylines from Google Maps API based on Jeffrey Sambells’ method and Sciolist’s method.


  • Decode: Decodes polyline and returns a list of paired lat/lng, based on Jeffrey Sambells’ method.

  • Encode: Encodes a list of paired lat/lng using the the Encoded Polyline Algorithm.

  • EncodeLatORLng: (Deprecated, not available in current version).

  • EncodePoint: (Deprecated, not available in current version, use Encode instead).

In order to test it, this example decodes this polyline [email protected] and later succesfully encode it back.

This homework is done!

I figured how to use at some point YailLists but I haven’t figured out how to manage a list of a list (list of paired lat/lng). It is homework! :rofl: But, meanwhile, here I present a workaround that works:

##Example .aia

APK: PolylineTools.aia (11,5 KB)
.AIA: com.pedroza.PolylineTools.aix (8,2 KB)
.AIX: PolylineTools.apk (2,8 MB)

This is extension is free and opensource available at: GitHub
Feel free to donate:
Also, you can donate to the App Inventor launch on iOS crowfunding campaign!


  • Sep 1st, 2017: Initial release.
  • Sep 2nd, 2017: Added EncodeLatORLng method.
  • Sep 5th, 2017: Added EncodePoint method.
  • Nov 24th, 2017: Added Encode list of paired lat/lng and EncodePoint and EncodeLatOrLng deprecated.

Best Regards from :venezuela:,
Carlos Pedroza


Felicitaciones Señor Carlos, muy buena extensión lo veo muy animado y me alegra. mantener el buen trabajo

1 Like

Muchas gracias sr Andres por sus buenos deseos


New function: Encode Lat or Lng!
See the first post!

1 Like

1 Like


I think I found this bug!

It’s kind of an embarrasing mistake! :sweat: Let me do some tests (so far it works!), and I’ll let you know about it!

Also I will update the encoding function in order to encode a list of paired lat/lng or at least a point (lat/lng) using the documentation @Andres_Cotes showed me:

Stay tuned!

debes revisar que los métodos que te compartí están en la la librería, pero en el las fuentes no están implementado todos debes buscar la clase en los archivos de inventor y revisar que métodos están disponibles

New function: EncodePoint
See the first post!

@thunkable Feel free to add it to your GoogleMaps component!


Thanks Carlos!!! This is awesome!

1 Like

Bonita extensión Carlos.

1 Like


Hi, @Carlos_Pedroza
Thanks for extension but I get error for polylines with lengthy characters.

The error is;
Error from Thunkable Live: lenght=66; index=66

This encoded polyline works;
}f|`@[email protected]@[email protected]

But this doesn’t;
ye|@[email protected]@kB\\[email protected]_APSDsATgBXuB@eATgEv@[email protected]

Is there a character limit for Thunkable because I get same error if I want to display the polyline in a label or textbox or notifier dialog.

Maybe someone with more experience with JSON will have a better answer, but the problem isn’t in the extension or the algorithm in decoding the polyline.

The problem is: in JSON “\” means “\”.

That is solved when you use Json TextDecode from the Web component:

If you want to copy and paste it from the JSON response then replace all “\” to “\”.

1 Like

Thanks @Carlos_Pedroza
I got it working following your solution using web json text decode and your extension.

1 Like

NEW UPDATE: Added Encode list of paired lat/lng and EncodePoint and EncodeLatOrLng deprecated.

1 Like

Sorry Andres_Cotes sir to reaching to you like this way, my question is off-topic. But I need your help. I wanted to directly question you, but didn’t found a link in community. I know you can only solve my problem. I have gone through many of your extensions and your many extensions have helped me in designing great app.
"I have designed an e-commerce app for selling my goods with the help of Thunkable.
I want to integrate different Payment Gateways like PayPal, PayUmoney, Paytm and SBI Bank in my app. How can I do that? Is there any extension available for it? Or it is impossible unless the app is to be designed in android studio?"
Please help me. You are my only hope

what is the use of this extension

Eu usei e consegui, parabens muito bom