1
0
mirror of https://github.com/moparisthebest/xeps synced 2024-12-01 13:42:14 -05:00
xeps/xep-0080.xml

525 lines
23 KiB
XML
Raw Normal View History

<?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 Geolocation</title>
<abstract>This document defines an XMPP protocol extension for communicating information about the current geographical 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-0060</spec>
</dependencies>
<supersedes/>
<supersededby/>
<shortname>geoloc</shortname>
<schemaloc>
<url>http://www.xmpp.org/schemas/geoloc.xsd</url>
</schemaloc>
&hildjj;
&stpeter;
<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 geolocation 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>alt</td>
<td>xs:decimal</td>
<td>Altitude in meters above or below sea level</td>
<td>1609</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>&nbsp;</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>USA</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>&nbsp;</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</td>
<td>10</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>10027</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>street</td>
<td>xs:string</td>
<td>A thoroughfare within the locality, or a crossing of two thoroughfares</td>
<td>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>
</table>
<p>NOTE: The datatypes specified above are defined in &w3xmlschema2;.</p>
</section1>
<section1 topic='Use Cases' anchor='usecases'>
<p>The location information SHOULD be communicated by means of &xep0060; or the subset of publish-subscribe specified in &xep0163;. Because location information is not pure presence information and can change independently of the user's availability, it SHOULD NOT be provided as an extension to &PRESENCE;, although an application MAY do so if necessary.</p>
<section2 topic='Entity publishes location via pubsub' anchor='usecases-pubsub'>
<p>In order to provide information about one's location, the publishing entity should use the pubsub protocol (the following examples show use of the publish-subscribe subset specified in <cite>XEP-0163</cite>).</p>
<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 id='a1s2d3f4g5h6bjeh936'>
<geoloc xmlns='http://jabber.org/protocol/geoloc' xml:lang='en'>
<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/home'>
<event xmlns='http://jabber.org/protocol/pubsub#event'>
<items node='http://jabber.org/protocol/geoloc'>
<item id='a1s2d3f4g5h6bjeh936'>
<geoloc xmlns='http://jabber.org/protocol/geoloc' xml:lang='en'>
<country>Italy</country>
<lat>45.44</lat>
<locality>Venice</locality>
<lon>12.33</lon>
</geoloc>
</item>
</items>
</event>
</message>
]]></example>
</section2>
<section2 topic='Entity requests the location of another entity' anchor='usecases-request'>
<p>If an entity wishes to request the location of another entity but the requestee does not publish that information via pubsub (including PEP), the requestor MAY send an IQ to the requestee:</p>
<example caption='Location request'><![CDATA[
<iq type='get'
id='loc_1'
from='juliet@capulet.com/balcony'
to='romeo@montague.net/garden'>
<geoloc xmlns='http://jabber.org/protocol/geoloc'/>
</iq>]]></example>
<p>The receiving entity SHOULD make a careful access control decision before returning the actual location.</p>
<example caption='Successful location response'><![CDATA[
<iq type='result'
id='loc_1'
to='juliet@capulet.com/balcony'
from='romeo@montague.net/garden'>
<geoloc xmlns='http://jabber.org/protocol/geoloc' xml:lang='en'>
<country>Italy</country>
<lat>45.44</lat>
<locality>Venice</locality>
<lon>12.33</lon>
</geoloc>
</iq>]]></example>
<p>If the receiving entity decides not to return the actual location, it MUST return an IQ error, which SHOULD be &forbidden; but MAY be some other appropriate error, such as &notallowed;:</p>
<example caption='Access to location information denied'><![CDATA[
<iq type='error'
id='loc_1'
to='juliet@capulet.com/balcony'
from='romeo@montague.net/garden'>
<geoloc xmlns='http://jabber.org/protocol/geoloc'/>
<error code='403' type='auth'>
<forbidden xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error>
</iq>
]]></example>
</section2>
<section2 topic='Sending location' anchor='usecases-send'>
<p>If an entity wants to send another entity its postition but it does not publish that information via pubsub, it MAY do so in a message. There SHOULD be a body element so that receiving entities that do not support the geolocation protocol can present a message to the recipient.</p>
<example caption='Message containing location'><![CDATA[
<message
to='polonius@hamlet.lit'
from='horatio@hamlet.lit/castle'>
<body>This message contains a location.</body>
<geoloc xmlns='http://jabber.org/protocol/geoloc' xml:lang='en'>
<description>Elsinore</description>
<lat>56.033</lat>
<lon>12.618</lon>
</geoloc>
<x xmlns='jabber:x:oob'>
<url>
http://www.mapquest.com/maps/map.adp?latlongtype=decimal&latitude=56.033&longitude=12.618
</url>
</x>
</message>]]></example>
</section2>
<section2 topic='Entity publishes location in presence' anchor='usecases-presence'>
<p>If an entity wishes all of the entities on its roster to be informed of a new location, the entity MAY publish a presence stanza that includes a location, although this is NOT RECOMMENDED (since location SHOULD be published using pubsub instead in order to ensure appropriate access control):</p>
<example caption='Location in presence'><![CDATA[
<presence>
<geoloc xmlns='http://jabber.org/protocol/geoloc' xml:lang='en'>
<alt>1609</alt>
<description>Jabber, Inc.</description>
<error>10</error>
<lat>39.75477</lat>
<lon>-104.99768</lon>
<timestamp>2004-02-19T21:12Z</timestamp>
</geoloc>
</presence>]]></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;error/&gt; MUST be arc minutes.</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.jabber.org/protocol/geoloc/gps_datum.html'>http://www.jabber.org/protocol/geoloc/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'>--</td>
<td align='center'>&lt;Accuracy/&gt;
<note>This element provides accuracy in meters. The geolocation protocol defined in XEP-0080 specifies such an element for XMPP, which SHOULD be used when mapping from IMPS to XMPP.</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;error/&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 minOccur='0'>
<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='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='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:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
]]></code>
</section1>
</xep>