XEP-0350: Data Forms Geolocation Element

Abstract:This specification defines an XMPP protocol extension for including geolocation data in XEP-0004 data forms.
Author:Michael Laukner
Copyright:© 1999 - 2015 XMPP Standards Foundation. SEE LEGAL NOTICES.
Status:Experimental
Type:Standards Track
Version:0.1
Last Updated:2014-07-03

WARNING: This Standards-Track document is Experimental. Publication as an XMPP Extension Protocol does not imply approval of this proposal by the XMPP Standards Foundation. Implementation of the protocol described herein is encouraged in exploratory implementations, but production systems are advised to carefully consider whether it is appropriate to deploy implementations of this protocol before it advances to a status of Draft.


Table of Contents


1. Introduction
2. Requirements
3. Integrate Geolocation Element with XEP-0004
4. Allow Receiver to Valdidate Geolocation Data
    4.1. Location Datatypes for Data Forms
5. Security Considerations
6. IANA Considerations
7. XMPP Registrar Considerations
    7.1. Protocol Namespaces
    7.2. Location Fields and Data Form Validation Datatypes
    7.3. Text Field and Data Form Validation Datatypes
8. 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

In certain protocols that make use of Data Forms (XEP-0004) [1], it can be helpful to include geolocation data. One example of such a "using protocol" is Form Discovery and Publishing (XEP-0346) [2]. This document defines a method for including geolocation data in a Data Form 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.

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 XMPP Registrar [3] 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.

2. Requirements

This proposal addresses the following requirements:

3. Integrate Geolocation Element with XEP-0004

The root element for geolocation data is <geoloc/> as defined in User Geolocation (XEP-0080) [4]. 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.

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.

Example 1. Inclusion in Data Form

<x xmlns='jabber:x:data' type='form'>
  [ ... ]
   <field var='location'>
     <geoloc xmlns="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>

4. Allow Receiver to Valdidate Geolocation Data

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:

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.

Example 2. Validation of Geolocation Data

<x xmlns='jabber:x:data' 
   xmlns:geo= http://jabber.org/protocol/geoloc'
   xmlns:xdv='http://jabber.org/protocols/xdata-validate'
   type='form'>
  <title>Sample Location Form</title>
  <instructions>
    Please provide information for the following location fields...
  </instructions>
  <field type='text-single' var='name' label='Event Name'/>
  <field type='text-single' var='time' label='Event Date/Time'>
    <xdv:validate datatype='xs:dateTime'>
      <basic/>
    </xdv:validate>
  </field>
  <field type='text-single' var='latitude' label='Latitude'>
    <xdv:validate datatype='geo:lat'>
      <basic/>
    </xdv:validate>
  </field>
  <field type='text-single' var='longitude' label='Longitude'>
    <xdv:validate datatype='geo:lon'>
      <basic/>
    </xdv:validate>
  </field>
</x>

4.1 Location Datatypes for Data Forms

The integration with Data Forms is accomplished via the datatypes specified in Data Forms Validation (XEP-0122) [5]. 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.

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

6. IANA Considerations

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

7. XMPP Registrar Considerations

7.1 Protocol Namespaces

The XMPP Registrar [7] already includes 'http://jabber.org/protocol/geoloc' in its registry of protocol namespaces (see <http://xmpp.org/registrar/namespaces.html>).

7.2 Location Fields and Data Form Validation Datatypes

The XMPP Registrar includes 'geo:' in its registry of Data Forms Validation Datatype Prefixes.

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:

Latitude Validation Datatype Registry Submission

<datatype>
  <name>geo:lat</name>
  <desc>Datatype for publishing the latitude of a geographic location</desc>
  <doc>XEP-0080</doc>
</datatype>

Example 3. Validation of a XEP-0080 Latitude Field

<field type='text-single' var='latitude' label='Latitude'>
  <xdv:validate datatype='geo:lat'>
    <range min='-90' 
           max='90'/>
  </xdv:validate>
  <value>45.44</value>
</field>

Longitude Validation Datatype Registry Submission

<datatype>
  <name>geo:lon</name>
  <desc>Datatype for publishing the longitude of a geographic location</desc>
  <doc>XEP-0080</doc>
</datatype>

Example 4. Validation of XEP-0080 Longitude Field

<field type='text-single' var='longitude' label='Longitude'>
  <xdv:validate datatype='geo:lon'>
    <range min='-180' 
         max='180'/>
  </xdv:validate>
  <value>12.33</value>
</field>

7.3 Text Field and Data Form Validation Datatypes

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.

DMS Data Forms Validation Datatype Registry Submission

<datatype>
  <name>geo:dms</name>
  <desc>Datatype for publishing a degrees, minutes, and seconds (DMS) location</desc>
  <doc>Degree Minutes and Seconds, 'http://en.wikipedia.org/wiki/Geographic_coordinate_system'.</doc>
</datatype>

Example 5. Validation of a DMS Location Field

<field type='text-single' var='dms_location'>
  <xdv:validate datatype='geo:dms'/>
    <regex>([-|\\+]?\\d{1,3}[d|D|\u00B0|\\s](\\s*\\d{1,2}['|\u2019|\\s])?(\\s*\\d{1,2}[\"|\u201d])?\\s*[N|n|S|s]?)?(\\s*|,|,\\s*)?([-|\\+]?\\d+?(\\.\\d+?)??\\s*[E|e|W|w]??)</regex>
  </xdv:validate>
  <value>52d18'24.4775"N 0d52'44.0625"W</value>
</field>

MGRS Data Forms Validation Datatype Registry Submission

<datatype>
  <name>geo:mgrs</name>
  <desc>Datatype for publishing a MGRS location</desc>
  <doc>Military Grid Reference System, 'http://en.wikipedia.org/wiki/Military_grid_reference_system'.</doc>  
</datatype>

Example 6. Validation of a MGRS Location Field

<field type='text-single' var='mgrs_location'>
  <xdv:validate datatype='geo:mgrs'/>
    <regex>\\d{1,2}[A-Za-z]\\s*[A-Za-z]{2}\\s*\\d{1,5}\\s*\\d{1,5}</regex>
  </xdv:validate>
  <value>38SMB4484</value>
</field>

8. XML Schema

As this document only defines semantics for existing protocol, additional schemas are not required.


Appendices


Appendix A: Document Information

Series: XEP
Number: 0350
Publisher: XMPP Standards Foundation
Status: Experimental
Type: Standards Track
Version: 0.1
Last Updated: 2014-07-03
Approving Body: XMPP Council
Dependencies: XMPP Core, XEP-0004, XEP-0080, XEP-0122
Supersedes: None
Superseded By: None
Short Name: geolocation-element
Schema: <http://www.xmpp.org/schemas/geolocation-element.xsd>
Source Control: HTML
This document in other formats: XML  PDF


Appendix B: Author Information

Michael Laukner

Email: laukner@gmail.com
JabberID: laukner@jabber.org


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. XEP-0004: Data Forms <http://xmpp.org/extensions/xep-0004.html>.

2. XEP-0346: Form Discovery and Publishing <http://xmpp.org/extensions/xep-0346.html>.

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

4. XEP-0080: User Geolocation <http://xmpp.org/extensions/xep-0080.html>.

5. XEP-0122: Data Forms Validation <http://xmpp.org/extensions/xep-0122.html>.

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

7. 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 0.1 (2014-07-03)

Initial published version approved by the XMPP Council.

(editor (mam))

Version 0.0.3 (2014-06-28)

Updated version, added 'geo:' datatypes to support 'text-single' use case.

(ml)

Version 0.0.2 (2014-06-25)

Updated version, added XEP-0122 'geo:' datatypes.

(ml)

Version 0.0.1 (2014-06-11)

Initial version, borrowing from XEP-0221.

(ml)

END