1. Home
  2. Tutorials
  3. Using Native Functionality
  4. Display Information about a Location Selected by the User

Display Information about a Location Selected by the User

ios pin
If your app contains a Map Element, you can detect the user long-pressing a location, which you can then present information about. With a Map added to a page in your app:

  1. Add a new variable in the Page Variables tab on the right of the editor. Give the variable a name and choose CLLocation type. create location var
  2. Select the Map Element on the Canvas and open Properties > Events. Open the Long Press Event.
  3. Click the plus button to add an Action – select Set Value. Click Edit.
    • In the first input, select the Page Variable you created.
    • In the second input, select the location the user touched using the Event Data container touchLocation value. set touch location
    • Save the Action.
  4. Add another Action, this time choosing Reverse Geocode Location. In the input, select the Page Variable you just updated. select location
  5. In the nested Placemark Found Event, add an Action to display the information, for example to include a pin on the map, select the Add Pin to Map Action.
    • Select the Map Element in the first input.
    • For the Title input, pull a value from the information returned from the Event Data in the Placemark Found Event, such as the placemark name. placemark found event data
    • For the subtitle input, do the same as you did for the previous input, but choosing a different value such as the placemark address.
    • For the Location input, select the Page Variable. pin location

You can use the Reverse Geocode Location data in other Actions, such as Set Value if you want to display the data in other Elements. To access information about a pin tapped by the user, or to tailor what happens when the user interacts with the pins, use the Map Element Annotation View Selected Event, in which you can retrieve data from the pin via the Event Data container. You can alternatively retrieve information about a location from latitude and longitude.

android marker
If your app contains a Map Element, you can detect the user long-pressing a location, which you can then present information about. With a Map added to a page in your app:

  1. Add a new variable in the Page Variables tab on the right of the editor. Give the variable a name and choose LatLng type. create latlng var
  2. Select the Map Element on the Canvas and open Properties > Events. Open the Long Press Event.
  3. Click the plus button to add an Action – select Set Value. Click Edit.
    • In the first input, select the Page Variable you created.
    • In the second input, select the location the user touched using the Event Data container touchLocation value. set latlng
    • Save the Action.
  4. Add another Action, this time choosing Reverse Geocode. In the input, select the Page Variable you just updated. reverse touched
  5. In the nested Address Found Event, add an Action to display the information, for example to include a marker on the map, select the Create Marker Action.
    • Select the Map Element in the first input.
    • For the Title input, pull a value from the information returned from the Event Data in the Address Found Event, such as the first line of the address. address found
    • For the subtitle input, do the same as you did for the previous input, but choosing a different value such as the next line of the address.
    • For the Location input, select the Page Variable. address location

You can use the Reverse Geocode data in other Actions, such as Set Value if you want to display the data in other Elements. To access information about a marker tapped by the user, or to tailor what happens when the user interacts with the markers, use the Map Element Marker Selected Event, in which you can retrieve data from the pin via the Event Data container. You can alternatively retrieve information about a location from latitude and longitude.

Was this article helpful to you? Yes No

How can we help?