Qt Location ModuleThe Qt Location API provides positioning, mapping, navigation, and place search via QML and C++ interfaces. OverviewThe 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. Getting StartedTo load the Qt Location module, add the following statement to your .qml files import QtLocation 5.0 For C++ projects include the header appropriate for the current use case, for example applications using routes may use #include <QGeoRoute>
The .pro file should have the location keyword added QT += location Concepts (in a QML Context)What follows assumes that we are using the Qt Location QML API. 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 Geographic Coordinate. The QML position is stored in a Coordinate which contains the latitude, longitude and altitude of the device. The Location contains this Coordinate and adds an address, and a bounding box thus making the location a region and not just a point. Now that the device has a position, with regular updates the API can determine the speed and heading of the device. It can define a box or a circle that can produce a notification when the device either leaves or enters that region. If we introduce the idea of a Map with positions of interest, Places, then the device can be made aware of nearby features and related information, displayed graphically. Features on the Map may be places of business, entertainment and so on. They may include paths, roads, or forms of transport leading to the idea that navigation optimization and assistance are possible. To enable navigation we need Routes from start to destination. These routes are made up of segments. Each RouteSegment can be considered a navigation sub-task: drive 100 meters, turn left. The beginning and end of each segment is a 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 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 Place types would hold information about the destination and surrounding objects including displayable representations. The Map type would enable this information to be displayed, panned, zoomed and so on. The Route would be determined by a plugin with each RouteSegment holding the navigation instructions guided by the updated current Location. Plugins 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 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 which 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. API Sub-Modules[ sub-module relationships diagram ] The API is split into three core sub-modules, which each have QML and C++ APIs. PositioningPositioning 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.
PlacesPlaces 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, and integrate with platform sources or a user's favorites to add user content, such as photos or a review, related to the place.
Maps and Navigation[ Image showing Mapviewer containing place, map and navigation details ] 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).
New Since Qt4In Qt4 QtMobility provided some location functionality for positioning and Maps with landmarks support. The new Qt Location API has had an extensive reworking of Maps and Places (formerly Landmarks). New features of Qt Location includes
API References and ExamplesAlphabetized lists of all classes and user interface components in the API, as well as detailed example applications to demonstrate their usage.
Plugin References and ParametersInformation about plugins, important notes on their usage, parameters that can be provided to influence their behavior.
Implementing New Back-Ends and PortingFor systems integrators and distributors, information relating to making Qt Location available for a new platform.
|