<p>In certain protocols that make use of &xep0004;, it can be helpful to include geolocation data. One example of such a "using protocol" is &xep0346;. This document defines a method for including geolocation data in a <cite>Data Form</cite> for something you manage and want to publish. This XEP leaves it open to developers how such a <geoloc/> form element will be rendered; possibilities might include editing Latitude and Longitude manually or through a rendered map.</p>
<p>There may also be the need to gather location data from both humans (using a GUI format) and computer processes (using a pre-defined but flexible format). This document defines a flexible mechanism for the ®ISTRAR; to standardize geographical location field names in data forms, thus enabling XMPP clients to process location fields in forms while giving protocol authors a way to specify additional location data types for non-GUI processors to determine the semantic meanings of a location field.</p>
<p>This proposal addresses the following requirements:</p>
<ul>
<li>Integrate geolocation data with XEP-0004.</li>
<li>Allow a potential receiver (rather than the sender) to validate geolocation data.</li>
</ul>
</section1>
<section1topic='Integrate Geolocation Element with XEP-0004'anchor='geolocation'>
<p>The root element for geolocation data is <geoloc/> as defined in &xep0080;. The information is structured by means of a <geoloc/> element that is qualified by the 'http://jabber.org/protocol/geoloc' namespace. The <geo/> element MUST be contained within a <field/> element qualified by the 'jabber:x:data' namespace.</p>
<p>The following example is provided only for the purpose of illustration; consult the specifications for using protocols (e.g., XEP-0080) to see canonical examples.</p>
<examplecaption='Inclusion in Data Form'><![CDATA[<x xmlns='jabber:x:data' type='form'>
[ ... ]
<fieldvar='location'>
<geolocxmlns="http://jabber.org/protocol/geoloc">
<text>Venice, Italy</text>
<locality>Venice</locality>
<country>Italy</country>
<lat>45.44</lat>
<lon>12.33</lon>
</geoloc>
</field>
[ ... ]
</x>]]></example>
</section1>
<section1topic='Allow Receiver to Valdidate Geolocation Data'anchor='validation'>
<p>All elements associated with location fields MUST be qualified by the 'http://jabber.org/protocol/geoloc' namespace. The use of namespace prefixes is RECOMMENDED for large forms, to reduce the data size. To maintain the highest level of compatibility, implementations sending the form using prefixes SHOULD use the namespace prefix "geo:", and SHOULD declare the namespace prefix mapping in the ancestor <x xmlns='jabber:x:data'/> element:</p>
<p>The following example is provided only for the purpose of illustration; consult the specifications for using protocols (e.g. XEP-0080, XEP-0122) to see canonical examples.</p>
<section2topic='Location Datatypes for Data Forms'anchor='location_fields'>
<p>The integration with Data Forms is accomplished via the datatypes specified in &xep0122;. Each datatype is specific to the profile desired. The sender MUST use the 'geo:' datatypes as specified in XEP-0122. When submitting a form, a field's value(s) MUST be validated by the receiving entity based on the 'geo:' datatype identifier(s). Also, the submitter MUST provide a 'geo:' element for each location element within the data form. If a form-submitting entity receives a field type it does not understand, the 'text-single' field type from XEP-0004 MUST be assumed.</p>
<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 <accuracy /> element SHOULD NOT be included.</p>
The ®ISTRAR; already includes 'http://jabber.org/protocol/geoloc' in its registry of protocol namespaces (see &NAMESPACES;).
</p>
</section2>
<section2topic='Location Fields and Data Form Validation Datatypes'anchor='registrar.geo.xep'>
<p>The XMPP Registrar includes 'geo:' in its registry of Data Forms Validation Datatype Prefixes.</p>
<p>Normally, each geographic format that wishes to be considered for use with Data Forms MUST register its own datatype qualified by the "geo:" prefix. However, this document provides an initial seed, based on the currently assumed formats. The following datatypes shall be registered for use with Data Forms Validation:</p>
<section2topic='Text Field and Data Form Validation Datatypes'anchor='registrar.geo.text'>
<p>The XMPP Registrar MAY include 'geo:' datatypes in its registry of Data Forms Validation Datatypes, which can be used with the 'text-single' field type from XEP-0004.</p>