hello dear community
i want to add marker when user touch on the map. but cannot this. help me please
hello dear community
i want to add marker when user touch on the map. but cannot this. help me please
Hi there,
Have you seen this way?
https://docs.thunkable.com/map#add-marker
Thanks.
This option add marker to my current location, but i need to ability adding marker on the map where user want (by touching)
Hi,
In the onPress map block, use these blocks to get the coordinates for the marker. To the right of these blocks you need to attach the green block âcoordinateâ
Thank you very much for your response! I will try and share result with you.
Thank you again!
it is the solution! THANK YOU!
Maybe I am doing it wrong but it does not work for me - nothing happening âontouchâ
Update: I realized some really weird behavior here. To test if the coordinates were returned properly I used an alert to show me what was returned. If I used the blocks for latitude alone or longitude alone it returned something but no matter what - as soon as I added both of the âget propertyâ block combinations in the do section it would always stop working at all (not even continuing to the further blocks).
I guess that might also be the reason why I donât get any marker to show up. Ideas how to solve this?
Perhaps you are dealing with a bug in the system, in that the âcoordinateâ exists only for a single access.
If this is the case, a work around would be to save the coordinate in a local variable, so that it could be accessed on your own terms.
And since you always extract coordinate of nativeEvent, might as well save THAT instead, so you would have an object with only longitude and latitude properties, thus saving the need to re-extract to that level.
@Chris @CBVG, I ran into the same thing when creating this tutorial app for the map component, but used a variable instead to get everything working:
Hi, I was looking for this solution, but when I found it, it seems not working to me.
If I Get only latitude, it works
If i get only longitude, it works
But If i place them into a join it doesnât return nothing.
In the same join, if I disconnect latitude or longitude I get the remaining value. If both, no results.
What could be the problem?
Can you show your blocks?
Sure,
in pic#1 no navigation to screen2
in pic#2 it goes to screen2 without any problem if i get only longitude or only latitude
in pic#3 a solution I just found. but I canât figure out why it works and not the pic#1
I was going to suggest you use an approach like #3 as that will work.
As a best practice, you should store the coordinate
value in a variable and the work with the variable.
This is the method outlined in our tutorial here:
I have a hunch that this may be due to an over-active garbage collection in the system, i.e. something that is beyond the control of users to fix (but possibly something that Thunkable should be looking into).
As you probably know, X Thunkable has the capability of creating new objects, and each object created takes memory space. With this comes the need to occasionally clean up the memory of objects that are no longer needed, and this is where possibly the problem may be. If the memory management is overly agressive, it may label any access to the âcoordinateâ as the one that identifies as âyouâve seen this already, so you do not need anymoreâ. Normally, such labeling should wait until the END of the .onPress block.
Therefore, your alternative then is to take your single access opportunity to duplicate the information in a form that is less volatile, that will remain at least until YOU decide you are finished with it.
That is what is happening in your 3rd approach; the whole coordinate property of nativeEvent of coordinate is duplicated in your own âcoordâ variable, giving you the opportunity to access at your leisure, since that object you define will not be considered garbage until the app itself has ended.
But that is still clearly a âbugâ from a programmer and userâs perspective.
This maybe?
Can you please show me the whole block or share a version of this project??
Thanks
Link to which project are you interested in?
Best regards, Alex
ACtech demo project
Thunkable X Basic Programming Course
Block Reference
Component Reference
Bug tracker
Polipaint
Map canvas
Method Inspector
Performance