lightning:formattedLocation

Displays a geolocation in Decimal degrees (DD) using the format [latitude, longitude]. This component requires API version 41.0 and later.

A lightning:formattedLocation component displays a read-only representation of a latitude and longitude value. Latitude and longitude are geographic coordinates specified in decimal degrees. If one of the values are invalid or outside the allowed range, this component doesn't display anything.

Here are a few examples of latitudes: -30, 45, 37.12345678, -10.0. Values such as 90.5 or -90.5 are not valid latitudes. Here are a few examples of longitudes: -100, -120.9762, 115.84. Values such as 180.5 or -180.5 are not valid longitudes.

This example displays a geolocation with a latitude of 37.7938460 and a longitude of -122.3948370.

<aura:component>
    <lightning:formattedLocation latitude="37.7938460" longitude="-122.3948370"/>
</aura:component>

Attributes

Attribute Name Attribute type Description Required?
body Component[] The body of the component. In markup, this is everything in the body of the tag.
class String A CSS class for the outer element, in addition to the component's base classes.
title String Displays tooltip text when the mouse moves over the element.
latitude Decimal The latitude value of the geolocation. Latitude values must be within -90 and 90. Yes
longitude Decimal The longitude value of the geolocation. Longitude values must be within -180 and 180. Yes