summaryrefslogtreecommitdiffstats
path: root/doc/src/qtlocation.qdoc
blob: f30e308d4c7e0ecb694c5a95e29ce2854718c2ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia.  For licensing terms and
** conditions see http://qt.digia.com/licensing.  For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file.  Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
**
****************************************************************************/




/*!
    \module QtLocation
    \title Qt Location Module
    \ingroup modules

    \brief Location module provides positioning, mapping, navigation, and place search
       via QML and C++ interfaces.

    To load the Qt Location module, add the following statement to your .qml files

    \code
        import QtLocation 5.0
    \endcode

    For C++ projects include the header appropriate for the current use case,
    for example applications using routes may use

    \code #include <QGeoRoute> \endcode

    The .pro file should have the \e location keyword added

    \code
        QT += location
    \endcode


    See more in the \l{Qt Location}{Qt Location Overview}.

*/



/*!
\page index-qtlocation-module.html
\title Qt Location
\brief The Qt Location API provides positioning, mapping, navigation, and place search
       via QML and C++ interfaces.
\ingroup technology-apis

The Qt Location API provides positioning, mapping, navigation, and place search via QML
and C++ interfaces.

\section1 Overview

The Qt Location API gives developers the ability to determine a position by
using a variety of possible sources, including satellite, or wifi, or text file,
and so on. That information can then be used to determine a position in a map
context with appropriate navigation and to embed, in the map, defined places
with descriptive metadata. These three parts
allow a device to know where it is and its location with respect to important
features. Using features such as roads, destinations, routes,
and other navigation attributes, applications can specify beginning and end-points
for navigation and awareness of objects that may aid or hinder a journey.

\section1 Getting Started

To load the Qt Location module, add the following statement to your .qml files

\code
    import QtLocation 5.0
\endcode

For C++ projects include the header appropriate for the current use case,
for example applications using routes may use

\code #include <QGeoRoute> \endcode

The .pro file should have the \e location keyword added

\code
    QT += location
\endcode

\section2 Location QML Concepts

Position information can come from a variety of sources including satellites,
wifi, text files and so on. The position is described by the usual latitude,
longitude, and the altitude in meters. For more information see
\l {http://en.wikipedia.org/wiki/Geographic_coordinate}{Geographic Coordinate}.

The QML position is stored in a \l {QtLocation5::coordinate}{coordinate} which contains the
latitude, longitude and altitude of the device.  The \l {QtLocation5::Location}{Location} contains
this \l {QtLocation5::coordinate}{coordinate} and adds an address, it also has a bounding box which
defines the recommended viewing region when displaying the location.

Now that the device has a position, with regular updates the API can determine
the speed and heading of the device. It can also define a box or a circle that can
produce a notification when the device either leaves or enters that region.

Adding a \l {QtLocation5::Map}{Map} with positions of interest and
\l {QtLocation5::Place}{Places}, then the device can be made aware of nearby features and related
information, displayed graphically. Features on the \l Map may be places of business, entertainment
and so on.  They may include paths, roads, or forms of transport leading so that
navigation optimization and assistance are possible.

To perform navigation we need \l {Route}s from start to destination. These routes
are made up of segments. Each \l {QtLocation5::RouteSegment}{RouteSegment}
can be considered a navigation sub-task: drive 100 meters, turn left. The beginning and
end of each segment is a \e waypoint, that is, one part of our journey.

A typical use case for the API is a user looking for a particular type of
place, say a restaurant. The user could enter a search string into the map
application and respond to a list or display of results for restaurants
"near" the device. The application could then be used to navigate to the
restaurant using an optimized route that is aware of features in the
environment that can help or hinder the journey. The navigation then
proceeds with the user's progress monitored by means of the current
\l Location. In the context of this API the map application would be aware
of the location and size of various places and the location of the user.
Plugins would supply the data used by the application to determine routes and
navigation instructions. The \l Place types would hold information about the
destination and surrounding objects including displayable representations.
The \l Map type would enable this information to be displayed, panned,
zoomed and so on. The \l Route would be determined by a plugin with each
\l RouteSegment holding the navigation instructions guided by the updated
current \l Location.

\l {Plugin}s are a means of specifying which Location based service to use. For example,
a plugin may allow connection to a provider's service that handles geocoding and routing
that the API and application can use. There may be various GeoServices plugins for various tasks
with some plugins providing more than one service. One QML \l Plugin should be created
for each required GeoService plugin. Plugins are required for maps, routing and geocoding,
however the default plugin handles all three of these services. A plugin may
require online access or may support on-board maps and data. The default "nokia"
plugin only supports online use. The connection would be managed by QNetworkInfo and
QNetworkConfigurationManager.

\note: Plugins may not provide various features such as paging or relevance hints.
Since plugins may be supplied by other providers, support for these aspects is
dependent on the provider's implementation.



\section2 API Sub-Modules
The API is split into three core sub-modules, which each have QML and C++
APIs.

\section3 Positioning
Positioning includes all the functionality necessary to find and work with geographic
coordinates. It can use a variety of external sources of information, including GPS. This
provides us with a coordinate and altitude for the device with additional features
such as speed and direction. This provides the fundamental location information used in the API.
\table
\row
    \li Positioning introduction:
    \li \l{Positioning (QML)}{for QML}
    \li \l{Qt Location C++ API}{for C++}
\endtable

\section3 Places
Places is
the natural complement to Positioning, providing a source of geographic
data about places of interest (POIs). As well as providing the location,
size and other vitals about a POI, the Places API can also retrieve images,
reviews and other rich content related to the place.

\table
\row
    \li Places introduction:
    \li \l{QML Places API}{for QML}
    \li \l{Places (C++)}{for C++}
\endtable

\section3 Maps and Navigation
Maps and Navigation provides Qt Quick user
interface components for displaying geographic information on a map, as
well as allowing user interaction with map objects and the display itself.
It also contains utilities for geocoding (finding a geographic coordinate
from a street address) and navigation (including driving and walking
directions).
\table
\row

\li Maps and Navigation introduction:
    \li \l{Maps and Navigation (QML)}{for QML}
    \li \l{Maps and Navigation (C++)}{for C++}
\endtable

\section1 API References and Examples

Alphabetized lists of all classes and user interface components in the API, as well as detailed
example applications to demonstrate their usage.

\table
    \row
        \li \l {Qt Location 5.x}{QML API Reference}
        \li Full list of QML components in the Qt Location API
    \row
        \li \l {Qt Location C++ API}{C++ API Reference}
        \li Full list of C++ classes and methods in the Qt Location API
    \row
        \li \l {Qt Location Examples}{Example Apps}
        \li Examples demonstrating use of the Qt Location APIs
\endtable

\section1 Plugin References and Parameters

Information about plugins, important notes on their usage, parameters that can
be provided to influence their behavior.

\annotatedlist QtLocation-plugins

\section2 Implementing New Back-Ends and Porting

For systems integrators and distributors, information relating to making
Qt Location available for a new platform.

\table
    \row
        \li \l {Qt Location GeoServices}{GeoServices}
        \li Information about the Qt Location GeoServices plugins
    \row
        \li \l {Places Backend} {Places}
        \li Information for places backend implementors
\endtable

\section1 New Since Qt 4

In Qt 4 Qt Mobility provided some location functionality for Positioning and Maps
with Landmarks support. The new Qt Location API has had an extensive reworking
of \l {Map}s and \l Places (formerly Landmarks). Also both C++ and QML APIs have
been reworked to be simpler to use.

New features of Qt Location includes
\list
    \li Maps are now part of the Qt Quick scenegraph, and rendered using hardware-accelerated OpenGL
    \li Arbitrary Qt Quick items on the map are supported using \l MapQuickItem
    \li Now possible to create map overlays with a model
    \li Built-in support for pinch-to-zoom gestures (\l MapPinchArea), flicking (\l MapFlickable), and panning
    \li Vast performance improvements over Qt Mobility 1.2, especially for large map polylines and objects in general
    \li Full QML API now available for routing and geocoding -- compatible with standard QML model-view design
    \li Service provider feature detection without having to open all the available plugins
    \li Unified "Plugin" QML type used by routing/geocoding/maps etc with easy-to-set PluginParameters
    \li Two plugins are supplied with Qt (a Nokia and an OSM plugin for GeoServices).
    \li Landmarks API is replaced by the Places API
    \li \l Places supports viewing of richer content such as reviews, images, and editorials
    \li \l Places supports locale handling, sponsored search results, and supplier attribution
\endlist

*/