XEP-0080: User Location

Abstract:This specification defines an XMPP protocol extension for communicating information about the current geographical or physical location of an entity.
Authors:Joe Hildebrand, Peter Saint-Andre
Copyright:© 1999 - 2014 XMPP Standards Foundation. SEE LEGAL NOTICES.
Status:Draft
Type:Standards Track
Version:1.7
Last Updated:2009-09-15

NOTICE: The protocol defined herein is a Draft Standard of the XMPP Standards Foundation. Implementations are encouraged and the protocol is appropriate for deployment in production systems, but some changes to the protocol are possible before it becomes a Final Standard.


Table of Contents


1. Introduction
2. Requirements
3. Data Format
4. Recommended Transport
    4.1. Entity publishes location via PEP
5. Implementation Notes
6. Mapping to Other Formats
7. Internationalization Considerations
8. Security Considerations
9. IANA Considerations
10. XMPP Registrar Considerations
    10.1. Protocol Namespaces
11. XML Schema

Appendices
    A: Document Information
    B: Author Information
    C: Legal Notices
    D: Relation to XMPP
    E: Discussion Venue
    F: Requirements Conformance
    G: Notes
    H: Revision History


1. Introduction

This document defines a format for capturing data about an entity's geographical location (geoloc). The format defined herein can describe most earthbound geographical locations, especially locations that may change fairly frequently. Potential uses for this approach include:

Geographical location is captured in terms of Global Positioning System (GPS) coordinates as well as civil location (city, street, building, etc.).

2. Requirements

The format defined herein was designed to address the following requirements:

3. Data Format

Information about the entity's location is provided by the entity and propagated on the network by the entity's associated application (usually a client). The information is structured by means of a <geoloc/> element that is qualified by the 'http://jabber.org/protocol/geoloc' namespace; the location information itself is provided as the XML character data of the following child elements:

Table 1: Child Elements

Element Name Datatype Definition Example
accuracy xs:decimal Horizontal GPS error in meters; this element obsoletes the <error/> element 10
alt xs:decimal Altitude in meters above or below sea level 1609
area xs:string A named area such as a campus or neighborhood Central Park
bearing xs:decimal GPS bearing (direction in which the entity is heading to reach its next waypoint), measured in decimal degrees relative to true north [1]  
building xs:string A specific building on a street or in an area The Empire State Building
country xs:string The nation where the user is located United States
countrycode xs:string The ISO 3166 two-letter country code US
datum xs:string GPS datum [2]  
description xs:string A natural-language name for or description of the location Bill's house
error xs:decimal Horizontal GPS error in arc minutes; this element is deprecated in favor of <accuracy/> 290.8882087
floor xs:string A particular floor in a building 102
lat xs:decimal Latitude in decimal degrees North 39.75
locality xs:string A locality within the administrative region, such as a town or city New York City
lon xs:decimal Longitude in decimal degrees East -104.99
postalcode xs:string A code used for postal delivery 10118
region xs:string An administrative region of the nation, such as a state or province New York
room xs:string A particular room in a building Observatory
speed xs:decimal The speed at which the entity is moving, in meters per second 52.69
street xs:string A thoroughfare within the locality, or a crossing of two thoroughfares 350 Fifth Avenue / 34th and Broadway
text xs:string A catch-all element that captures any other information about the location Northwest corner of the lobby
timestamp xs:dateTime UTC timestamp specifying the moment when the reading was taken (MUST conform to the DateTime profile of XMPP Date and Time Profiles (XEP-0082) [3]) 2004-02-19T21:12Z
uri xs:anyURI A URI or URL pointing to information about the location http://www.esbnyc.com/

NOTE: The datatypes specified above are defined in XML Schema Part 2 [4].

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] (the examples below assume that the user's XMPP server supports PEP, thus the publish request lacks a 'to' address and the notification message has a 'from' address of the user's bare JID).

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/>.

4.1 Entity publishes location via PEP

Example 1. Entity publishes location

<iq type='set' from='portia@merchantofvenice.lit/pda' id='publish1'>
  <pubsub xmlns='http://jabber.org/protocol/pubsub'>
    <publish node='http://jabber.org/protocol/geoloc'>
      <item>
        <geoloc xmlns='http://jabber.org/protocol/geoloc' xml:lang='en'>
          <accuracy>20</accuracy>
          <country>Italy</country>
          <lat>45.44</lat>
          <locality>Venice</locality>
          <lon>12.33</lon>
        </geoloc>
      </item>
    </publish>
  </pubsub>
</iq>
    

Example 2. Subscriber receives event with payload

<message from='portia@merchantofvenice.lit' 
         to='bassanio@merchantofvenice.lit'>
  <event xmlns='http://jabber.org/protocol/pubsub#event'>
    <items node='http://jabber.org/protocol/geoloc'>
      <item id='d81a52b8-0f9c-11dc-9bc8-001143d5d5db'>
        <geoloc xmlns='http://jabber.org/protocol/geoloc' xml:lang='en'>
          <accuracy>20</accuracy>
          <country>Italy</country>
          <lat>45.44</lat>
          <locality>Venice</locality>
          <lon>12.33</lon>
        </geoloc>
      </item>
    </items>
  </event>
</message>
    

In order to indicate that the user is no longer publishing any location information, the user's client shall send an empty <geoloc/> element, which can be considered a "stop command" for geolocation:

Example 3. User stops publishing geolocation information

<iq from='portia@merchantofvenice.lit/pda' 
    id='publish2'
    type='set'>
  <pubsub xmlns='http://jabber.org/protocol/pubsub'>
    <publish node='http://jabber.org/protocol/geoloc'>
      <item>
        <geoloc xmlns='http://jabber.org/protocol/geoloc'/>
      </item>
    </publish>
  </pubsub>
</iq>
    

Example 4. Subscriber receives empty event

<message from='portia@merchantofvenice.lit' 
         to='bassanio@merchantofvenice.lit'>
  <event xmlns='http://jabber.org/protocol/pubsub#event'>
    <items node='http://jabber.org/protocol/geoloc'>
      <item id='d81a52b8-0f9c-11dc-9bc8-001143d5d5db'>
        <geoloc xmlns='http://jabber.org/protocol/geoloc'/>
      </item>
    </items>
  </event>
</message>
    

5. Implementation Notes

Avoid "Mars probe" issues: as specified in Table 1, the units for <lat/> and <lon/> MUST be decimal degrees (where South and West are negative, North and East are positive), the units for <alt/> MUST be meters above or below sea level, and the units for <accuracy/> MUST be meters. [7]

In applications where updates are sent whenever there is a certain distance change in location, those applications SHOULD account for time as well, to avoid rate-limiting when the user is (for example) on a jet plane. One possible way to do this would be to send updates at most once per minute of time (every time 60 seconds have elapsed).

Inferences SHOULD NOT be made about accuracy from the number of digits specified in the location or altitude.

Why the datum madness? See <http://www.xmpp.org/extensions/gps_datum.html> for an example.

An entity can provide a GPS path by publishing a series of items (i.e., multiple pubsub events) with appropriate values of the <timestamp/> element.

6. Mapping to Other Formats

There are many XML data formats for physical location or address information. It is beyond the scope of this document to provide a mapping from the extension defined herein to every such format. However, it would be valuable to provide a mapping from the XMPP format to the formats used in other presence or extended presence protocols. The two main protocols of interest are:

  1. The Wireless Village (now "IMPS") specifications for mobile instant messaging; these specifications define a presence attribute for address information as encapsulated in the IMPS "Address" element [8].

  2. The SIP-based SIMPLE specifications; in particular, the IETF's GEOPRIV Working Group has defined an extension to the IETF's Presence Information Data Format (PIDF) [9] for location information, as specified in RFC 4119 [10] (also known as "PIDF-LO").

The following table also maps the format defined herein to the vCard XML format specified in vcard-temp (XEP-0054) [11].

Table 2: Mapping XMPP Physical Location to IMPS, PIDF-LO, and vCard

XMPP Wireless Village / IMPS SIMPLE (PIDF-LO) vCard XML
<country/> <Country/> <country/> <CTRY/> [12]
<region/> -- <A1/> and/or <A2/> <REGION/>
<locality/> <City/> <A3/> <LOCALITY/>
<area/> <NamedArea/> <A4/> and/or <A5/> --
<street/> <Street/> [13] <A6/> [14] <STREET/>
<building/> <Building/> <LMK/> --
<floor/> -- <FLR/> --
<room/> -- -- --
<postalcode/> -- <PC/> <PCODE/>
<text/> <FreeTextLocation/> <LOC/> <EXTADR/>
<accuracy/> <Accuracy/> [15] -- --
-- -- <NAM/> [16] --

7. Internationalization Considerations

Because the character data contained in <geoloc/> child elements of type 'xs:string' is intended to be readable by humans, the <geoloc/> element SHOULD possess an 'xml:lang' attribute specifying the natural language of such character data.

8. Security Considerations

It is imperative to control access to location information, at least by default. Imagine that a stalker got unauthorized access to this information, with enough accuracy and timeliness to be able to find the target person. This scenario could lead to loss of life, so please take access control checks seriously. If an error is deliberately added to a location, the error SHOULD be the same for all receivers, to minimize the likelihood of triangulation. In the case of deliberate error, the <accuracy/> element SHOULD NOT be included.

9. IANA Considerations

This document requires no interaction with the Internet Assigned Numbers Authority (IANA) [17].

10. XMPP Registrar Considerations

10.1 Protocol Namespaces

The XMPP Registrar [18] includes 'http://jabber.org/protocol/geoloc' to its registry of protocol namespaces.

11. XML Schema

<?xml version='1.0' encoding='UTF-8'?>

<xs:schema 
    xmlns:xs='http://www.w3.org/2001/XMLSchema'
    targetNamespace='http://jabber.org/protocol/geoloc' 
    xmlns='http://jabber.org/protocol/geoloc'
    elementFormDefault='qualified'>

  <xs:annotation>
    <xs:documentation>
      The protocol documented by this schema is defined in
      XEP-0080: http://www.xmpp.org/extensions/xep-0080.html
    </xs:documentation>
  </xs:annotation>

  <xs:element name='geoloc'>
    <xs:complexType>
      <xs:sequence minOccurs='0'>
        <xs:element name='accuracy' minOccurs='0' type='xs:decimal'/>
        <xs:element name='alt' minOccurs='0' type='xs:decimal'/>
        <xs:element name='area' minOccurs='0' type='xs:string'/>
        <xs:element name='bearing' minOccurs='0' type='xs:decimal'/>
        <xs:element name='building' minOccurs='0' type='xs:string'/>
        <xs:element name='country' minOccurs='0' type='xs:string'/>
        <xs:element name='countrycode' minOccurs='0' type='xs:string'/>
        <xs:element name='datum' minOccurs='0' type='xs:string'/>
        <xs:element name='description' minOccurs='0' type='xs:string'/>
        <xs:element name='error' minOccurs='0' type='xs:decimal'/>
        <xs:element name='floor' minOccurs='0' type='xs:string'/>
        <xs:element name='lat' minOccurs='0' type='xs:decimal'/>
        <xs:element name='locality' minOccurs='0' type='xs:string'/>
        <xs:element name='lon' minOccurs='0' type='xs:decimal'/>
        <xs:element name='postalcode' minOccurs='0' type='xs:string'/>
        <xs:element name='region' minOccurs='0' type='xs:string'/>
        <xs:element name='room' minOccurs='0' type='xs:string'/>
        <xs:element name='speed' minOccurs='0' type='xs:decimal'/>
        <xs:element name='street' minOccurs='0' type='xs:string'/>
        <xs:element name='text' minOccurs='0' type='xs:string'/>
        <xs:element name='timestamp' minOccurs='0' type='xs:dateTime'/>
        <xs:element name='uri' minOccurs='0' type='xs:anyURI'/>
      </xs:sequence>
      <xs:attribute ref='xml:lang' use='optional'/>
    </xs:complexType>
  </xs:element>

</xs:schema>
  

Appendices


Appendix A: Document Information

Series: XEP
Number: 0080
Publisher: XMPP Standards Foundation
Status: Draft
Type: Standards Track
Version: 1.7
Last Updated: 2009-09-15
Approving Body: XMPP Council
Dependencies: XMPP Core, XEP-0163
Supersedes: None
Superseded By: None
Short Name: geoloc
Schema: <http://www.xmpp.org/schemas/geoloc.xsd>
Source Control: HTML
This document in other formats: XML  PDF


Appendix B: Author Information

Joe Hildebrand

Email: jhildebr@cisco.com
JabberID: hildjj@jabber.org

Peter Saint-Andre

Email: stpeter@jabber.org
JabberID: stpeter@jabber.org
URI: https://stpeter.im/


Appendix C: Legal Notices

Copyright

This XMPP Extension Protocol is copyright © 1999 - 2014 by the XMPP Standards Foundation (XSF).

Permissions

Permission is hereby granted, free of charge, to any person obtaining a copy of this specification (the "Specification"), to make use of the Specification without restriction, including without limitation the rights to implement the Specification in a software program, deploy the Specification in a network service, and copy, modify, merge, publish, translate, distribute, sublicense, or sell copies of the Specification, and to permit persons to whom the Specification is furnished to do so, subject to the condition that the foregoing copyright notice and this permission notice shall be included in all copies or substantial portions of the Specification. Unless separate permission is granted, modified works that are redistributed shall not contain misleading information regarding the authors, title, number, or publisher of the Specification, and shall not claim endorsement of the modified works by the authors, any organization or project to which the authors belong, or the XMPP Standards Foundation.

Disclaimer of Warranty

## NOTE WELL: This Specification is provided on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. ##

Limitation of Liability

In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall the XMPP Standards Foundation or any author of this Specification be liable for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising from, out of, or in connection with the Specification or the implementation, deployment, or other use of the Specification (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if the XMPP Standards Foundation or such author has been advised of the possibility of such damages.

IPR Conformance

This XMPP Extension Protocol has been contributed in full conformance with the XSF's Intellectual Property Rights Policy (a copy of which can be found at <http://xmpp.org/about-xmpp/xsf/xsf-ipr-policy/> or obtained by writing to XMPP Standards Foundation, 1899 Wynkoop Street, Suite 600, Denver, CO 80202 USA).

Appendix D: Relation to XMPP

The Extensible Messaging and Presence Protocol (XMPP) is defined in the XMPP Core (RFC 6120) and XMPP IM (RFC 6121) specifications contributed by the XMPP Standards Foundation to the Internet Standards Process, which is managed by the Internet Engineering Task Force in accordance with RFC 2026. Any protocol defined in this document has been developed outside the Internet Standards Process and is to be understood as an extension to XMPP rather than as an evolution, development, or modification of XMPP itself.


Appendix E: Discussion Venue

The primary venue for discussion of XMPP Extension Protocols is the <standards@xmpp.org> discussion list.

Discussion on other xmpp.org discussion lists might also be appropriate; see <http://xmpp.org/about/discuss.shtml> for a complete list.

Errata can be sent to <editor@xmpp.org>.


Appendix F: Requirements Conformance

The following requirements keywords as used in this document are to be interpreted as described in RFC 2119: "MUST", "SHALL", "REQUIRED"; "MUST NOT", "SHALL NOT"; "SHOULD", "RECOMMENDED"; "SHOULD NOT", "NOT RECOMMENDED"; "MAY", "OPTIONAL".


Appendix G: Notes

1. It is the responsibility of the receiver to translate bearing into decimal degrees relative to magnetic north, if desired.

2. If datum is not included, receiver MUST assume WGS84; receivers MUST implement WGS84; senders MAY use another datum, but it is not recommended.

3. XEP-0082: XMPP Date and Time Profiles <http://xmpp.org/extensions/xep-0082.html>.

4. XML Schema Part 2: Datatypes <http://www.w3.org/TR/xmlschema-2/>.

5. XEP-0060: Publish-Subscribe <http://xmpp.org/extensions/xep-0060.html>.

6. XEP-0163: Personal Eventing Protocol <http://xmpp.org/extensions/xep-0163.html>.

7. The <accuracy/> element obsoletes the older <error/> element, which specified units of arc minutes intead of meters.

8. The Wireless Village Initiative: Presence Attributes v1.1 (WV-029); for further information, visit <http://www.openmobilealliance.org/tech/affiliates/wv/wvindex.html>.

9. RFC 3863: Presence Information Data Format (PIDF) <http://tools.ietf.org/html/rfc3863>.

10. RFC 4119: A Presence-based GEOPRIV Location Object Format <http://tools.ietf.org/html/rfc4119>.

11. XEP-0054: vcard-temp <http://xmpp.org/extensions/xep-0054.html>.

12. As noted in XEP-0054, the XML vCard format defined in draft-dawson-vcard-xml-dtd-01 specified a <COUNTRY/> element rather than a <CTRY/> element; refer to XEP-0054 for details.

13. The IMPS specification also enables one to define an intersection (e.g., "Broadway and 34th Street") as the combination of a <Crossing1/> element (e.g., "Broadway") and a <Crossing2/> element (e.g., "34th Street"). To map from IMPS to XMPP, an application SHOULD map such a combination to one XMPP <street/> element.

14. The PIDF-LO format provides information elements for much more granular control over a traditional street address; in PIDF-LO the <A6/> element is the street name only, and further information is provided in distinct elements for a leading street direction (e.g., "N"), trailing street suffix (e.g., "SW"), street suffix (e.g., "Avenue"), house number (e.g., "909"), and house number suffix (e.g., "1/2"). To map from PIDF-LO to XMPP, an application SHOULD construct the complete street address from the PIDF-LO elements (<A6/>, <PRD/>, <POD/>, <STS/>, <HNO/>, and <HNS/>) and map the result to one XMPP <street/> element.

15. This element specifies accuracy in meters. When mapping from IMPS to XMPP, the IMPS <Accuracy/> element SHOULD be mapped to the XMPP <accuracy/> element (which specifies accuracy in meters), not the deprecated <error/> element (which specified accuracy in arc minutes).

16. This element provides a name for the location, e.g., a certain store in a building. This SHOULD be mapped to the XMPP <text/> element.

17. The Internet Assigned Numbers Authority (IANA) is the central coordinator for the assignment of unique parameter values for Internet protocols, such as port numbers and URI schemes. For further information, see <http://www.iana.org/>.

18. The XMPP Registrar maintains a list of reserved protocol namespaces as well as registries of parameters used in the context of XMPP extension protocols approved by the XMPP Standards Foundation. For further information, see <http://xmpp.org/registrar/>.


Appendix H: Revision History

Note: Older versions of this specification might be available at http://xmpp.org/extensions/attic/

Version 1.7 (2009-09-15)

Added <countrycode/> element.

(psa)

Version 1.6 (2008-10-29)

Allowed empty geoloc element to signify a pause in publishing; added <accuracy/> element and deprecated <error/> element to change horizontal GPS error from arc minutes to meters, consistent with IMPS and other formats.

(psa/jjh)

Version 1.5 (2008-01-30)

Added speed element.

(jjh/psa)

Version 1.4 (2007-07-16)

Renamed to User Location; corrected pubsub examples; recommended pubsub/PEP as transport for location information about human users; added uri element.

(psa)

Version 1.3 (2006-08-21)

Folded in civil location from XEP-0112.

(psa)

Version 1.2 (2005-05-12)

Changed xs:string to xs:decimal for bearing and specified that bearing is to be interpreted as decimal degrees relative to true north.

(psa)

Version 1.1 (2004-10-29)

Changed xs:int to xs:decimal for altitude; changed MUST NOT to SHOULD NOT regarding inferences about accuracy.

(psa)

Version 1.0 (2004-10-12)

Per a vote of the Jabber Council, advanced status to Draft; also added internationalization considerations and linked to an archived version of the GPS datum example.

(psa)

Version 0.9 (2004-10-12)

Clarified several points in the implementation notes.

(psa)

Version 0.8 (2004-09-15)

Specified error flow for IQ example.

(psa)

Version 0.7 (2004-04-25)

Corrected several errors; added reference to XEP-0033.

(psa)

Version 0.6 (2004-02-19)

Reverted from infobits to geoloc elements; moved physical address protocol back to XEP-0112.

(psa)

Version 0.5 (2003-12-16)

Converted to use of infobits.

(psa)

Version 0.4 (2003-09-08)

Merged in contents of XEP-0112.

(psa)

Version 0.3 (2003-08-21)

Changed protocol name from 'location' to 'geoloc'.

(psa)

Version 0.2 (2003-07-29)

Incorporated Standards list feedback; changed document type to Informational.

(psa)

Version 0.1 (2003-04-15)

Initial version.

(jjh)

END