[SOLVED] Convert "event" from "onMarkerPress" to a String or text

I am making a map app with many markers. I am trying to make it so when the user clicks on a marker, that location opens in Google Maps. To do so, I need the latitude and longitude as text to add to a link to Google Maps. How can I convert the “event” block, the output of “onMarkerPress”, to a String?

http://community.thunkable.com/t/solved-how-do-the-event-blocks-for-the-map-component-work/73742/3

This article shows someone who did so with the function “makeCoordinateText” but I do not understand how to create the function.

Does this help?

2 Likes

This is great - thanks for sharing @tatiang

Thanks so much for that awesome video! I tried it out by setting the output to an alert so that I could see what the output is and I seem to have gotten an empty String:

Here is my code:

Any idea what is wrong? Thanks again for the help!

Those blocks look ok @jlschmidt1224zf - I’d just get the values from the event first, store them in a new variable and then display this new value in your alert.

There’s something similar in this tutorial:

That article is exactly what I’m looking for! However, still when I try what it says to do, it does not show the coordinate. Here is my code and the corresponding screen that is shown:

(1) I did not include the “get property latitude” in this one


(2) I added the block to get the latitude and that is when it returned another empty String

You just need to omit the “get object properties” block since you want the values of the properties, and not the properties themselves.

It worked! Thanks so much! For future reference, here is the final code I used:
image

Thanks SO much!

2 Likes