0

could anyone tell me how to do Reverse geocoding in BB10. I have got latitude , longitude and now I need to convert it into address.

2 Answers2

1

There are geocoding and reverse-geocoding C++ examples on the BB10 Native documenation site, https://developer.blackberry.com/native/documentation/cascades/device_platform/location/geocoding.html did you look at that ?

onion
  • 417
  • 3
  • 3
0

I have done following code but having problem in that. QGeoCoordinate GCoor(lat,lang);

//Reverse GeoCoding
QStringList serviceProviders =
        QGeoServiceProvider::availableServiceProviders();
if (serviceProviders.size()) {
    QGeoServiceProvider *serviceProvider = new QGeoServiceProvider(
            serviceProviders.at(0));
    QGeoSearchManager *searchManager = serviceProvider->searchManager();
    //searchManager->setProperty("boundary", "city");
    reply = searchManager->reverseGeocode(GCoor);

    bool finished_connected = QObject::connect(reply, SIGNAL(finished()),
            this, SLOT(readReverseGeocode()));

    bool error_connected = QObject::connect(reply,
            SIGNAL(error(QGeoSearchReply::Error, QString)), this,
            SLOT(reverseGeocodeError(QGeoSearchReply::Error, QString)));


//Reverse GeoLocation
void LocationHandler::readReverseGeocode() {
QList<QGeoPlace> LocDetList = reply->places();
QGeoPlace locDe = LocDetList.at(0);
qDebug() << "City --> " << locDe.address().state();
qDebug() << "Country Code --> " << locDe.address().countryCode();
qDebug() << "Country --> " << locDe.address().country();

reply->deleteLater();
}

`void LocationHandler::reverseGeocodeError(QGeoSearchReply::Error error,
    QString errorString) {
qDebug() << "( Geo::reverseGeocodeError ) " << errorString;
reply->deleteLater();
}

The application is exiting at this line in this code -

QGeoPlace locDe = LocDetList.at(0); 

whats the problem here?