xeps/xep-0080.xml

564 rindas
24 KiB
XML

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE xep SYSTEM 'xep.dtd' [
<!ENTITY % ents SYSTEM 'xep.ent'>
%ents;
]>
<?xml-stylesheet type='text/xsl' href='xep.xsl'?>
<xep>
<header>
<title>User Location</title>
<abstract>This specification defines an XMPP protocol extension for communicating information about the current geographical or physical location of an entity.</abstract>
&LEGALNOTICE;
<number>0080</number>
<status>Draft</status>
<type>Standards Track</type>
<sig>Standards</sig>
<dependencies>
<spec>XMPP Core</spec>
<spec>XEP-0163</spec>
</dependencies>
<supersedes/>
<supersededby/>
<shortname>geoloc</shortname>
<schemaloc>
<url>http://www.xmpp.org/schemas/geoloc.xsd</url>
</schemaloc>
&hildjj;
&stpeter;
<revision>
<version>1.9</version>
<date>2015-12-01</date>
<initials>ls</initials>
<remark><p>Added &lt;altaccuracy/&gt; element.</p></remark>
</revision>
<revision>
<version>1.8</version>
<date>2014-05-07</date>
<initials>ls</initials>
<remark><p>Added &lt;tzo/&gt; element.</p></remark>
</revision>
<revision>
<version>1.7</version>
<date>2009-09-15</date>
<initials>psa</initials>
<remark><p>Added &lt;countrycode/&gt; element.</p></remark>
</revision>
<revision>
<version>1.6</version>
<date>2008-10-29</date>
<initials>psa/jjh</initials>
<remark><p>Allowed empty geoloc element to signify a pause in publishing; added &lt;accuracy/&gt; element and deprecated &lt;error/&gt; element to change horizontal GPS error from arc minutes to meters, consistent with IMPS and other formats.</p></remark>
</revision>
<revision>
<version>1.5</version>
<date>2008-01-30</date>
<initials>jjh/psa</initials>
<remark><p>Added speed element.</p></remark>
</revision>
<revision>
<version>1.4</version>
<date>2007-07-16</date>
<initials>psa</initials>
<remark><p>Renamed to User Location; corrected pubsub examples; recommended pubsub/PEP as transport for location information about human users; added uri element.</p></remark>
</revision>
<revision>
<version>1.3</version>
<date>2006-08-21</date>
<initials>psa</initials>
<remark><p>Folded in civil location from XEP-0112.</p></remark>
</revision>
<revision>
<version>1.2</version>
<date>2005-05-12</date>
<initials>psa</initials>
<remark><p>Changed xs:string to xs:decimal for bearing and specified that bearing is to be interpreted as decimal degrees relative to true north.</p></remark>
</revision>
<revision>
<version>1.1</version>
<date>2004-10-29</date>
<initials>psa</initials>
<remark><p>Changed xs:int to xs:decimal for altitude; changed MUST NOT to SHOULD NOT regarding inferences about accuracy.</p></remark>
</revision>
<revision>
<version>1.0</version>
<date>2004-10-12</date>
<initials>psa</initials>
<remark><p>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.</p></remark>
</revision>
<revision>
<version>0.9</version>
<date>2004-10-12</date>
<initials>psa</initials>
<remark><p>Clarified several points in the implementation notes.</p></remark>
</revision>
<revision>
<version>0.8</version>
<date>2004-09-15</date>
<initials>psa</initials>
<remark><p>Specified error flow for IQ example.</p></remark>
</revision>
<revision>
<version>0.7</version>
<date>2004-04-25</date>
<initials>psa</initials>
<remark><p>Corrected several errors; added reference to XEP-0033.</p></remark>
</revision>
<revision>
<version>0.6</version>
<date>2004-02-19</date>
<initials>psa</initials>
<remark><p>Reverted from infobits to geoloc elements; moved physical address protocol back to XEP-0112.</p></remark>
</revision>
<revision>
<version>0.5</version>
<date>2003-12-16</date>
<initials>psa</initials>
<remark><p>Converted to use of infobits.</p></remark>
</revision>
<revision>
<version>0.4</version>
<date>2003-09-08</date>
<initials>psa</initials>
<remark><p>Merged in contents of XEP-0112.</p></remark>
</revision>
<revision>
<version>0.3</version>
<date>2003-08-21</date>
<initials>psa</initials>
<remark><p>Changed protocol name from 'location' to 'geoloc'.</p></remark>
</revision>
<revision>
<version>0.2</version>
<date>2003-07-29</date>
<initials>psa</initials>
<remark><p>Incorporated Standards list feedback; changed document type to Informational.</p></remark>
</revision>
<revision>
<version>0.1</version>
<date>2003-04-15</date>
<initials>jjh</initials>
<remark><p>Initial version.</p></remark>
</revision>
</header>
<section1 topic='Introduction' anchor='intro'>
<p>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:</p>
<ul>
<li>Publishing location information to a set of subscribers.</li>
<li>Querying another entity for its location.</li>
<li>Sending location information to another entity.</li>
<li>Attaching location information to presence.</li>
</ul>
<p>Geographical location is captured in terms of Global Positioning System (GPS) coordinates as well as civil location (city, street, building, etc.).</p>
</section1>
<section1 topic='Requirements' anchor='reqs'>
<p>The format defined herein was designed to address the following requirements:</p>
<ul>
<li>It shall be possible to encapsulate location in terms of Global Positioning System (GPS) coordinates as well as civil location (city, street, building, etc.).</li>
<li>The GPS encoding mechanism shall have a single set of units, so that receivers do not need to use heuristics to determine an entity's position.</li>
<li>It shall be possible to specify the known amount of error in the GPS coordinates.</li>
<li>It shall be possible to include a natural-language description of the location.</li>
</ul>
</section1>
<section1 topic='Data Format' anchor='format'>
<p>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 &lt;geoloc/&gt; 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:</p>
<table caption='Child Elements'>
<tr>
<th>Element Name</th>
<th>Datatype</th>
<th>Definition</th>
<th>Example</th>
</tr>
<tr>
<td>accuracy</td>
<td>xs:decimal</td>
<td>Horizontal GPS error in meters; this element obsoletes the &lt;error/&gt; element</td>
<td>10</td>
</tr>
<tr>
<td>alt</td>
<td>xs:decimal</td>
<td>Altitude in meters above or below sea level</td>
<td>1609</td>
</tr>
<tr>
<td>altaccuracy</td>
<td>xs:decimal</td>
<td>Vertical GPS error in meters</td>
<td>10</td>
</tr>
<tr>
<td>area</td>
<td>xs:string</td>
<td>A named area such as a campus or neighborhood</td>
<td>Central Park</td>
</tr>
<tr>
<td>bearing</td>
<td>xs:decimal</td>
<td>GPS bearing (direction in which the entity is heading to reach its next waypoint), measured in decimal degrees relative to true north <note>It is the responsibility of the receiver to translate bearing into decimal degrees relative to magnetic north, if desired.</note></td>
<td>&#160;</td>
</tr>
<tr>
<td>building</td>
<td>xs:string</td>
<td>A specific building on a street or in an area</td>
<td>The Empire State Building</td>
</tr>
<tr>
<td>country</td>
<td>xs:string</td>
<td>The nation where the user is located</td>
<td>United States</td>
</tr>
<tr>
<td>countrycode</td>
<td>xs:string</td>
<td>The ISO 3166 two-letter country code</td>
<td>US</td>
</tr>
<tr>
<td>datum</td>
<td>xs:string</td>
<td>GPS datum <note>If datum is not included, receiver MUST assume WGS84; receivers MUST implement WGS84; senders MAY use another datum, but it is not recommended.</note></td>
<td>&#160;</td>
</tr>
<tr>
<td>description</td>
<td>xs:string</td>
<td>A natural-language name for or description of the location</td>
<td>Bill's house</td>
</tr>
<tr>
<td>error</td>
<td>xs:decimal</td>
<td>Horizontal GPS error in arc minutes; this element is deprecated in favor of &lt;accuracy/&gt;</td>
<td>290.8882087</td>
</tr>
<tr>
<td>floor</td>
<td>xs:string</td>
<td>A particular floor in a building</td>
<td>102</td>
</tr>
<tr>
<td>lat</td>
<td>xs:decimal</td>
<td>Latitude in decimal degrees North</td>
<td>39.75</td>
</tr>
<tr>
<td>locality</td>
<td>xs:string</td>
<td>A locality within the administrative region, such as a town or city</td>
<td>New York City</td>
</tr>
<tr>
<td>lon</td>
<td>xs:decimal</td>
<td>Longitude in decimal degrees East</td>
<td>-104.99</td>
</tr>
<tr>
<td>postalcode</td>
<td>xs:string</td>
<td>A code used for postal delivery</td>
<td>10118</td>
</tr>
<tr>
<td>region</td>
<td>xs:string</td>
<td>An administrative region of the nation, such as a state or province</td>
<td>New York</td>
</tr>
<tr>
<td>room</td>
<td>xs:string</td>
<td>A particular room in a building</td>
<td>Observatory</td>
</tr>
<tr>
<td>speed</td>
<td>xs:decimal</td>
<td>The speed at which the entity is moving, in meters per second</td>
<td>52.69</td>
</tr>
<tr>
<td>street</td>
<td>xs:string</td>
<td>A thoroughfare within the locality, or a crossing of two thoroughfares</td>
<td>350 Fifth Avenue / 34th and Broadway</td>
</tr>
<tr>
<td>text</td>
<td>xs:string</td>
<td>A catch-all element that captures any other information about the location</td>
<td>Northwest corner of the lobby</td>
</tr>
<tr>
<td>timestamp</td>
<td>xs:dateTime</td>
<td>UTC timestamp specifying the moment when the reading was taken (MUST conform to the DateTime profile of &xep0082;)</td>
<td>2004-02-19T21:12Z</td>
</tr>
<tr>
<td>tzo</td>
<td>xs:string</td>
<td>The time zone offset from UTC for the current location (MUST adhere to the Time Zone Definition (TZD) specified in &xep0082;)</td>
<td>-07:00</td>
</tr>
<tr>
<td>uri</td>
<td>xs:anyURI</td>
<td>A URI or URL pointing to information about the location</td>
<td>http://www.esbnyc.com/</td>
</tr>
</table>
<p>NOTE: The datatypes specified above are defined in &w3xmlschema2;.</p>
</section1>
<section1 topic='Recommended Transport' anchor='transport'>
<p>Location information about human users SHOULD be communicated and transported by means of &xep0060; or the subset thereof specified in &xep0163; (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).</p>
<p>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;.</p>
<section2 topic='Entity publishes location via PEP' anchor='usecases-pubsub'>
<example caption='Entity publishes location'><![CDATA[
<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>
<example caption='Subscriber receives event with payload'><![CDATA[
<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>
]]></example>
<p>In order to indicate that the user is no longer publishing any location information, the user's client shall send an empty &lt;geoloc/&gt; element, which can be considered a "stop command" for geolocation:</p>
<example caption='User stops publishing geolocation information'><![CDATA[
<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>
<example caption='Subscriber receives empty event'><![CDATA[
<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>
]]></example>
</section2>
</section1>
<section1 topic='Implementation Notes' anchor='impl'>
<p>Avoid "Mars probe" issues: as specified in Table 1, the units for &lt;lat/&gt; and &lt;lon/&gt; MUST be decimal degrees (where South and West are negative, North and East are positive), the units for &lt;alt/&gt; MUST be meters above or below sea level, and the units for &lt;accuracy/&gt; MUST be meters. <note>The &lt;accuracy/&gt; element obsoletes the older &lt;error/&gt; element, which specified units of arc minutes intead of meters.</note></p>
<p>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).</p>
<p>Inferences SHOULD NOT be made about accuracy from the number of digits specified in the location or altitude.</p>
<p>Why the datum madness? See &lt;<link url='http://www.xmpp.org/extensions/gps_datum.html'>http://www.xmpp.org/extensions/gps_datum.html</link>&gt; for an example.</p>
<p>An entity can provide a GPS path by publishing a series of items (i.e., multiple pubsub events) with appropriate values of the &lt;timestamp/&gt; element.</p>
</section1>
<section1 topic='Mapping to Other Formats' anchor='mapping'>
<p>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:</p>
<ol>
<li><p>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 <note>The Wireless Village Initiative: Presence Attributes v1.1 (WV-029); for further information, visit &lt;<link url='http://www.openmobilealliance.org/tech/affiliates/wv/wvindex.html'>http://www.openmobilealliance.org/tech/affiliates/wv/wvindex.html</link>&gt;.</note>.</p></li>
<li><p>The SIP-based SIMPLE specifications; in particular, the IETF's GEOPRIV Working Group has defined an extension to the IETF's &pidf; for location information, as specified in &rfc4119; (also known as "PIDF-LO").</p></li>
</ol>
<p>The following table also maps the format defined herein to the vCard XML format specified in &xep0054;.</p>
<table caption='Mapping XMPP Physical Location to IMPS, PIDF-LO, and vCard'>
<tr>
<th>XMPP</th>
<th>Wireless Village / IMPS</th>
<th>SIMPLE (PIDF-LO)</th>
<th>vCard XML</th>
</tr>
<tr>
<td align='center'>&lt;country/&gt;</td>
<td align='center'>&lt;Country/&gt;</td>
<td align='center'>&lt;country/&gt;</td>
<td align='center'>&lt;CTRY/&gt;
<note>As noted in XEP-0054, the XML vCard format defined in draft-dawson-vcard-xml-dtd-01 specified a &lt;COUNTRY/&gt; element rather than a &lt;CTRY/&gt; element; refer to XEP-0054 for details.</note>
</td>
</tr>
<tr>
<td align='center'>&lt;region/&gt;</td>
<td align='center'>--</td>
<td align='center'>&lt;A1/&gt; and/or &lt;A2/&gt;</td>
<td align='center'>&lt;REGION/&gt;</td>
</tr>
<tr>
<td align='center'>&lt;locality/&gt;</td>
<td align='center'>&lt;City/&gt;</td>
<td align='center'>&lt;A3/&gt;</td>
<td align='center'>&lt;LOCALITY/&gt;</td>
</tr>
<tr>
<td align='center'>&lt;area/&gt;</td>
<td align='center'>&lt;NamedArea/&gt;</td>
<td align='center'>&lt;A4/&gt; and/or &lt;A5/&gt;</td>
<td align='center'>--</td>
</tr>
<tr>
<td align='center'>&lt;street/&gt;</td>
<td align='center'>&lt;Street/&gt;
<note>The IMPS specification also enables one to define an intersection (e.g., "Broadway and 34th Street") as the combination of a &lt;Crossing1/&gt; element (e.g., "Broadway") and a &lt;Crossing2/&gt; element (e.g., "34th Street"). To map from IMPS to XMPP, an application SHOULD map such a combination to one XMPP &lt;street/&gt; element.</note>
</td>
<td align='center'>&lt;A6/&gt;
<note>The PIDF-LO format provides information elements for much more granular control over a traditional street address; in PIDF-LO the &lt;A6/&gt; 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 (&lt;A6/&gt;, &lt;PRD/&gt;, &lt;POD/&gt;, &lt;STS/&gt;, &lt;HNO/&gt;, and &lt;HNS/&gt;) and map the result to one XMPP &lt;street/&gt; element.</note>
</td>
<td align='center'>&lt;STREET/&gt;</td>
</tr>
<tr>
<td align='center'>&lt;building/&gt;</td>
<td align='center'>&lt;Building/&gt;</td>
<td align='center'>&lt;LMK/&gt;</td>
<td align='center'>--</td>
</tr>
<tr>
<td align='center'>&lt;floor/&gt;</td>
<td align='center'>--</td>
<td align='center'>&lt;FLR/&gt;</td>
<td align='center'>--</td>
</tr>
<tr>
<td align='center'>&lt;room/&gt;</td>
<td align='center'>--</td>
<td align='center'>--</td>
<td align='center'>--</td>
</tr>
<tr>
<td align='center'>&lt;postalcode/&gt;</td>
<td align='center'>--</td>
<td align='center'>&lt;PC/&gt;</td>
<td align='center'>&lt;PCODE/&gt;</td>
</tr>
<tr>
<td align='center'>&lt;text/&gt;</td>
<td align='center'>&lt;FreeTextLocation/&gt;</td>
<td align='center'>&lt;LOC/&gt;</td>
<td align='center'>&lt;EXTADR/&gt;</td>
</tr>
<tr>
<td align='center'>&lt;accuracy/&gt;</td>
<td align='center'>&lt;Accuracy/&gt;
<note>This element specifies accuracy in meters. When mapping from IMPS to XMPP, the IMPS &lt;Accuracy/&gt; element SHOULD be mapped to the XMPP &lt;accuracy/&gt; element (which specifies accuracy in meters), not the deprecated &lt;error/&gt; element (which specified accuracy in arc minutes).</note>
</td>
<td align='center'>--</td>
<td align='center'>--</td>
</tr>
<tr>
<td align='center'>--</td>
<td align='center'>--</td>
<td align='center'>&lt;NAM/&gt;
<note>This element provides a name for the location, e.g., a certain store in a building. This SHOULD be mapped to the XMPP &lt;text/&gt; element.</note>
</td>
<td align='center'>--</td>
</tr>
</table>
</section1>
<section1 topic='Internationalization Considerations' anchor='i18n'>
<p>Because the character data contained in &lt;geoloc/&gt; child elements of type 'xs:string' is intended to be readable by humans, the &lt;geoloc/&gt; element SHOULD possess an 'xml:lang' attribute specifying the natural language of such character data.</p>
</section1>
<section1 topic='Security Considerations' anchor='security'>
<p>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 &lt;accuracy/&gt; element SHOULD NOT be included.</p>
</section1>
<section1 topic='IANA Considerations' anchor='iana'>
<p>This document requires no interaction with &IANA;.</p>
</section1>
<section1 topic='XMPP Registrar Considerations' anchor='registrar'>
<section2 topic='Protocol Namespaces' anchor='registrar-ns'>
<p>The &REGISTRAR; includes 'http://jabber.org/protocol/geoloc' to its registry of protocol namespaces.</p>
</section2>
</section1>
<section1 topic='XML Schema' anchor='schema'>
<code><![CDATA[
<?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='altaccuracy' 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='tzo' minOccurs='0' type='xs:string'/>
<xs:element name='uri' minOccurs='0' type='xs:anyURI'/>
</xs:sequence>
<xs:attribute ref='xml:lang' use='optional'/>
</xs:complexType>
</xs:element>
</xs:schema>
]]></code>
</section1>
</xep>