Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.

Revision as of 20:09, 30 October 2013 by kiran10182 (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

QReverseGeocode component for quick reverse geocoding in QML

From Wiki
Jump to: navigation, search
Article Metadata
Code Example
Source file: QReverseGeocode
Tested with
Devices(s): Nokia N8, Nokia C7-00
Platform Security
Capabilities: NetworkServices
Keywords: Reverse Geocode
Created: galazzo (04 Jun 2012)
Last edited: kiran10182 (30 Oct 2013)
See Also



Reverse geocoding is the process of back (reverse) coding of a point location (latitude, longitude) to a readable address or place name. This permits the identification of nearby street addresses, places, and/or areal subdivisions such as neighbourhoods, county, state, or country. Combined with geocoding and routing services, reverse geocoding is a critical component of mobile location-based services.
Nokia provides one of the best location based services available and reverse geocoding is well supported in Qt/C++ and HTML5, but sometimes could be tricky to access this service from QML.
QReverseGeocode provide a quick and easy solution to manage reverse geocoding from QML.


  1. Download source code from here
  2. Include QReverseGeocode directory into your project




#include <QtGui/QApplication>
#include "qmlapplicationviewer.h"
#include <QtDeclarative>
#include "qreversegeocode.h"
Q_DECL_EXPORT int main(int argc, char *argv[])
QScopedPointer<QApplication> app(createApplication(argc, argv));
qmlRegisterType<QReverseGeocode>("QReverseGeocode", 1, 0, "QReverseGeocode");
QmlApplicationViewer viewer;
return app->exec();


Note.pngNote: QReverseGeocode have to be used in conjunction with PositionSource component as shown below

import QtQuick 1.1
import 1.1
import QtWebKit 1.0
import QtMobility.location 1.2
import QReverseGeocode 1.0
Page {
id: mainPage
Text {
id: place
text: ""
PositionSource {
id: positionSource
active: true
onPositionChanged: {
reverseGeocoder.latitude = positionSource.position.coordinate.latitude
reverseGeocoder.longitude = positionSource.position.coordinate.longitude
QReverseGeocode {
place.text=reverseGeocoder.postCode+" "

API Reference

Properties ( To use before calling process() )

  • latitude - Property that hold the latitude value
  • longitude - Property that hold the longitude value

Properties ( Filled when onReverseGeocodeFinished() is emitted )

  • city - Property that hold the city value
  • postCode - Property that hold post code value
  • street - Property that hold the street value
  • country - Property that hold the country value

Signals (handlers)

  • onLatitudeChanged() - Invoked when latitude property changes.
  • onLongitudeChanged() - Invoked when the longitude changes.
  • onReverseGeocodeFinished() - Invoked when the reverse geocode process is finished.


  • process() - Start the reverse geocoding process. Before calling this method the latitude and longitude properties have to be filled.


When onReverseGeocodeFinished() is emitted all address informations are stored into the properties described before, so you can compose your informations in the way you need. For example you could need to display just post code and city:

place.text=reverseGeocoder.postCode+" "

or just city and country:

onReverseGeocodeFinished:{" "

rather than all informations:

place.text=reverseGeocoder.street+"<br/>"+reverseGeocoder.postCode+" ""<br/>"
This page was last modified on 30 October 2013, at 20:09.
507 page views in the last 30 days.