[Solved] Get Lat and Lng from map press

Hi I was wondering how can I store the values of “lat” and “long” in a table?

Thanks

1 Like

Never mind, I finally did it. The mistake I made was that I did not treat the data from the event block as a text string.

All I did was create a list from the data and then split it using the “,”

2 Likes

I spoke too soon, I just faced another issue. The coordinates are meant to be integers but since I am extracting the values a string, it does not work on map.

How can I convert them to Integers?

Try assigning a string to a variable block, and then use some suitable mathematical block to perform an operation on this variable, for example, add its value with the value 0.

1 Like

mama mia nice hack. That worked :man_dancing:

I was trying to make mine work but screen 3 doesn’t open with these blocks (starting from screen 2, clicking the callout on the map). I was trying to understand what data the “event” gives. Eventually I want to change screen3 based on a local database list (which restaurant is chosen from the map).

image

Please take a look at my previous post in this thread (here) for some info on how to properly obtain longitude and latitude for the onPress, onMarkerPress and onLongPress event handlers of the Map component. Note that onCalloutPress appears to not work at all :frowning:

-Mark

Thanks for your reply :slight_smile: Actually I got onCalloutPress to work with the below blocks. It does save the latitude value of a marker to the local storage. Next problem is how to do a vlookup formula using the latitude value in local_db and returning another field in the spreadsheet. I can only find instructions if the choice is made in a list viewer… how to do that using a local storage value?

Frozen Aloha,

It’s not totally clear to me what you are trying to do. It seem as if you want to lookup a latitude value in one column of your local_db and then return another column in the same row of that local_db. Is that right?

By the way, I strongly suggest using stored variables instead of the Local Storage component. It’s generally much easier to use. Here are some blocks which demonstrate how you can use them when the variable name (which is essentially the same as the key for the Local Storage component) is not necessarily fixed.

50%20AM

In the above example the "test" block could be replaced with something that is looked up or calculated dynamically.

-Mark

https://community.thunkable.com/uploads/default/original/3X/0/f/0f4258ff7aaf77d21cf18f7c832f32b02da78729.png

These blocks doesnt work now. whats wrong?

but when I do below it gets longitude or latitude.


With these blocks I can get longitude but I can’t get latitude. Why? or How can I get both? What is changed?

Try this

%D0%B8%D0%B7%D0%BE%D0%B1%D1%80%D0%B0%D0%B6%D0%B5%D0%BD%D0%B8%D0%B5

3 Likes

This works. Thanks.

i have searching on all over thunkable community,
actualy it’s same method… but why on mine is not working…
i always got “null” on nativeEvent…

There seems to be a bug that makes the Coordinate Object only available once. Therefor the solution of @actech is a workaround by storing the value and retrieving the information from the stored object afterwards :slight_smile: