Class GeoLocation

  • All Implemented Interfaces:
    LanguageElement

    public final class GeoLocation
    extends Object
    implements LanguageElement
    The implementation of the <geoloc/> element in the http://jabber.org/protocol/geoloc namespace.

    This class represents the geological location of a user.

    4. Recommended Transport

    Location information about human users SHOULD be communicated and transported by means of Publish-Subscribe (XEP-0060) [5] or the subset thereof specified in Personal Eventing Protocol (XEP-0163) [6].

    Although the XMPP publish-subscribe extension is the preferred means for transporting location information about human users, applications that do not involve human users (e.g., device tracking) MAY use other transport methods; however, because location information is not pure presence information and can change independently of network availability, it SHOULD NOT be provided as an extension to <presence/>.

    Usage

    This class is immutable, you have to use a builder to create a geo location instance. Here's an example:

    
     GeoLocation geoLocation = GeoLocation.builder()
         .countryCode("de")
         .latitude(50.2)
         .longitude(7.5)
         .timeZoneOffset(ZoneOffset.of("+01:00"))
         .build();
     
    See Also:
    XEP-0080: User Location, XML Schema
    • Method Detail

      • builder

        public static GeoLocation.Builder builder()
        Creates the builder to build a geo location.
        Returns:
        The builder.
      • getAccuracy

        public final Double getAccuracy()
        Gets the horizontal GPS error in meters.
        Returns:
        The accuracy.
      • getAltitude

        public final Double getAltitude()
        Gets the altitude in meters above or below sea level.
        Returns:
        The altitude.
      • getAltitudeAccuracy

        public final Double getAltitudeAccuracy()
        Gets the vertical GPS error in meters.
        Returns:
        The altitude accuracy.
      • getArea

        public final String getArea()
        Gets a named area such as a campus or neighborhood.
        Returns:
        The area.
      • getBearing

        public final Double getBearing()
        Gets the GPS bearing (direction in which the entity is heading to reach its next waypoint), measured in decimal degrees relative to true north.
        Returns:
        The bearing.
      • getBuilding

        public final String getBuilding()
        Gets a specific building on a street or in an area.
        Returns:
        The building.
      • getCountry

        public final String getCountry()
        Gets the nation where the user is located.
        Returns:
        The country.
      • getCountryCode

        public final String getCountryCode()
        Gets the ISO 3166 two-letter country code.
        Returns:
        The country code.
      • getDatum

        public final String getDatum()
        Gets the GPS datum.
        Returns:
        The GPS datum.
      • getDescription

        public final String getDescription()
        Gets a natural-language name for or description of the location.
        Returns:
        The description.
      • getFloor

        public final String getFloor()
        Gets a particular floor in a building.
        Returns:
        The floor.
      • getLatitude

        public final Double getLatitude()
        Gets the latitude in decimal degrees North.
        Returns:
        The latitude.
      • getLocality

        public final String getLocality()
        Gets a locality within the administrative region, such as a town or city.
        Returns:
        The locality.
      • getLongitude

        public final Double getLongitude()
        Gets the longitude in decimal degrees East.
        Returns:
        The longitude.
      • getPostalCode

        public final String getPostalCode()
        Gets a code used for postal delivery.
        Returns:
        The postal code.
      • getRegion

        public final String getRegion()
        Gets an administrative region of the nation, such as a state or province.
        Returns:
        The region.
      • getRoom

        public final String getRoom()
        Gets a particular room in a building.
        Returns:
        The room.
      • getSpeed

        public final Double getSpeed()
        Gets the speed at which the entity is moving, in meters per second.
        Returns:
        The speed.
      • getStreet

        public final String getStreet()
        Gets a thoroughfare within the locality, or a crossing of two thoroughfares.
        Returns:
        The street.
      • getText

        public final String getText()
        Gets a catch-all element that captures any other information about the location.
        Returns:
        The text.
      • getTimestamp

        public final Instant getTimestamp()
        Gets the UTC timestamp specifying the moment when the reading was taken.
        Returns:
        The timestamp.
      • getUri

        public final URI getUri()
        Gets a URI or URL pointing to information about the location.
        Returns:
        The URI.
      • getLanguage

        public final Locale getLanguage()
        Gets the the natural language of location data.
        Specified by:
        getLanguage in interface LanguageElement
        Returns:
        The language.
      • getTimeZoneOffset

        public final ZoneOffset getTimeZoneOffset()
        Gets the time zone offset from UTC for the current location.
        Returns:
        The time zone offset.