Positioning (QML)
Location Positioning
Location data involves a precisely specified position on the Earth's surface — as provided by a latitude-longitude coordinate — along with associated data, such as:
- The date and time at which the position was reported
- The velocity of the device that reported the position
- The altitude of the reported position (height above sea level)
- The bearing of the device in degrees, relative to true north
For more information see Geographic Coordinate.
This data can be extracted through a variety of methods. One of the most well known methods of positioning is GPS (Global Positioning System), a publicly available system that uses radiowave signals received from Earth-orbiting satellites to calculate the precise position and time of the receiver. Another popular method is 'Cell Identifier Positioning', which uses the cell identifier of the cell site that is currently serving the receiving device to calculate its approximate location. These and other positioning methods can all be used with the Location API; the only requirement for a location data source within the API is that it provides a latitude-longitude coordinate with a date/time value, with the option of providing the other attributes listed above.
Coordinate
The coordinate is a basic unit of geographical information. The coordinate type has attributes to hold the latitude
, longitude
and altitude
.
Position
The three dimensional position of an object such as a mobile device can be specified by giving the latitude, longitude and altitude. That is the values held in the l {coordinate} type. Additionally for computation of future positions we would like to know if the object is moving, what speed it is doing and what is the timestamp of the last position data. Position therefore includes values for the coordinate, speed and a timestamp. Position also takes responsibility for validation of sensible values for these properties. These are exposed as the latitudeValid, longitudeValid, altitudeValid, speedValid, horizontalAccuracyValid, and verticalAccuracyValid properties.
PositionSource
We have a Position type, a coordinate type but where does the data come from? Also it is a good idea to be able to indicate alternative sources. Perhaps instead of directly picking up GPS satellites it might be desirable to do some testing using a datafile.
The PositionSource type provides the developer with control, within the limits allowed by the platform, of the source of the geographical data. Apart from tradtional sources such as GPS and cell data the positional data can be sourced from a logfile which is in NMEA format.
NMEA is a common text-based protocol for specifying navigational data. For convenience, the nmeaSource property is provided to enable QML applications to read NMEA data from a log file or a TCP socket, the source will emit updates according to the time stamp of each NMEA sentence to produce a "replay" of the recorded data. To use a TCP socket set the "socket" uri scheme.
PositionSource {
nmeaSource: "socket://127.0.0.1:12345"
}
Flickr Example
The Flickr Example uses the Location to download thumbnail images from Flickr relevant to the current location.
© 2015 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.