Category: How do I do X?

This solution is summarized from an archived support forum post. This information may have changed. If you notice an error, please let us know in Discord.

Map select one location


I need to allow the user to pick a single location on a map, but the current option creates a new marker every time they tap the map. I want to re-use the same marker if they pick a new location. I asked for advice and was told to enable the onMarkerCreated event and store the value of the marker as "loc". Then, in the default markers, I can read this value to ensure that it always only has the last marker that was created. It works great!


The problem was to allow a user to select a single location on a map without creating a new marker for every tap. The solution proposed was to enable the "Create new marker" option and set the onMarkerCreated event to store the value of the created marker as a variable. This was done using the following code: {{storeValue('loc', Map1.selectedMarker)}}.

To ensure that only the last marker created was selected by the user, the code in the default markers was modified to read the value of the "loc" variable and display that marker. The code used for this was: {{}}.

Overall, this solution allowed the user to select a single location on the map and reuse the same marker if they decided to select a new location.