1. Home
  2. Tutorials
  3. Using Native Functionality
  4. Display Location Information from Latitude and Longitude

Display Location Information from Latitude and Longitude

reverse geocode ios
If you have a latitude and longitude in your app, for example from an API request, you can retrieve and display readable information about the location in a map pin or the other Elements in your pages.

  1. Add an Action to an Event where the latitude and longitude will be available, for example a request Event if the data is in an API response. Open the relevant Event, and click the plus plus button, and choose Create a Location Object. Edit the Action.
    • Select the latitude and longitude values in your app, for example using the Event Data container if they’re in an API response. event data longitude

    Save the Action.

  2. Add another Action, this time choosing Reverse Geocode Location.
    • Select the CLLocation object returned from the previous Action, via the Action Data container. cllocation returned
  3. In the nested Placemark Found Event, you can access and display the geographical information. For example:
    • To display the info in a text Element, use a Set Value Action, choosing the information from the Event Data container. placemark found container
    • To display the info on a map, use the Set Visible Map Region Action to show the location returned from Create a Location Object, and the Add Pin to Map Action to display fields from the Event Data reverse geocode container in a map pin. When the pin displays on the map, the user will be able to tap it and see the text you added as title and subtitle. add pin reverse

You can alternatively display place information about a location selected by the user on touching the map. If you only need to pinpoint a location from latitude and longitude and don’t need to retrieve readable text information about the place, you don’t need the geocode Action. You can also send location data to the device maps app to show directions.

reverse geocode android
If you have a latitude and longitude in your app, for example from an API request, you can retrieve and display readable information about the location in a map marker or in other Elements in your pages.

  1. Add an Action to an Event where the latitude and longitude will be available, for example a request Event if the data is in an API response. Open the relevant Event, and click the plus plus button, and choose Create a LatLng Object. Edit the Action.
    • Select the latitude and longitude values in your app, for example using the Event Data container if they’re in an API response. select longitude

    Save the Action.

  2. Add another Action, this time choosing Reverse Geocode.
    • Select the LatLng object returned from the previous Action, via the Action Data container. latlng returned
  3. In the nested Address Found Event, you can access and display the geographical information. For example:
    • To display the info in a text Element, use a Set Value Action, choosing the information from the Event Data container. address found
    • To display the info on a map, use the Set Visible Map Region Action to show the location returned from Create a LatLng Object, and the Create Marker Action to display fields from the Event Data reverse geocode container in a map marker. When the marker displays on the map, the user will be able to tap it and see the text you added as title and subtitle. address found pin

You can alternatively display place information about a location selected by the user on touching the map. If you only need to pinpoint a location from latitude and longitude and don’t need to retrieve readable text information about the place, you don’t need the geocode Action. You can also send location data to the device maps app to show directions.

Was this article helpful to you? Yes No

How can we help?