Geocoding and reverse geocoding in Qt Mobility
-
wrote on 14 Feb 2011, 16:34 last edited by
Hi
I'm using the latest Qt Mobility in my app. QGeoServiceProvider::availableServiceProviders() returns one result - "nokia". This search provider returns true for both supportsGeocoding() and supportsReverseGeocoding(), however all geocoding and reversegeocoding requests return no results.
Are these features currently supported? Is there any other way to access them on Qt?
Thanks
-
wrote on 14 Feb 2011, 20:46 last edited by
I recently tried this on Maemo (qtm1.2 beta), where it wasn't working and then two weeks later on Symbian^3 with qtm1.1 it worked fine. I'm still unsure, if it's just a fluctuation in service availability, or if it's something else. So if you are lucky getting it spit out something, it would be nice to hear, which configuration worked when and how.
-
wrote on 8 Dec 2011, 16:43 last edited by
I have the same problem. Does anybody have an update on this issue ? Is the service just flaky, am I doing something stupid or is QGeoSearchManager borked ?
*Update: problem solved - I was creating the service provider object on the stack. Without the service provider object, nothing works, obviously. Updated the code to show the working version.
Here is the code I'm using:
@
QGeoServiceProvider *geoServiceProvider = new QGeoServiceProvider("nokia");
if (geoServiceProvider->error() == QGeoServiceProvider::NoError) {
QGeoSearchManager *geoSearchManager = geoServiceProvider->searchManager();
if (geoSearchManager && geoSearchManager->supportsReverseGeocoding()) {
m_geoSearchReply = geoSearchManager->reverseGeocode(m_geoCoordinate);
if (m_geoSearchReply) {
if (m_geoSearchReply->isFinished()) {
if (m_geoSearchReply->error() == QGeoSearchReply::NoError) {
finished();
} else {
error(m_geoSearchReply->error(), m_geoSearchReply->errorString());
}
} else {
connect(m_geoSearchReply, SIGNAL(finished()), this, SLOT(finished()));
connect(m_geoSearchReply, SIGNAL(error(QGeoSearchReply::Error, const QString&)), this, SLOT(error(QGeoSearchReply::Error, const QString&)));
}
}
} else {
qDebug() << "failed to find search manager";
}
}
}@