谁能告诉我如何在BB10中进行反向地理编码。我有纬度,经度,现在我需要将其转换为地址。
答案 0 :(得分:1)
BB10 Native文档站点上有地理编码和反向地理编码C ++示例,https://developer.blackberry.com/native/documentation/cascades/device_platform/location/geocoding.html你看过那个吗?
答案 1 :(得分:0)
我已经完成了以下代码,但是遇到了问题。 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();
}
应用程序在此代码中退出此行 -
QGeoPlace locDe = LocDetList.at(0);
这里的问题是什么?