Ejemplo n.º 1
0
QGeoSearchReply* QGeoSearchManagerEngineNokia::reverseGeocode(const QGeoCoordinate &coordinate,
        QGeoBoundingArea *bounds)
{
    if (!supportsReverseGeocoding()) {
        QGeoSearchReply *reply = new QGeoSearchReply(QGeoSearchReply::UnsupportedOptionError, "Reverse geocoding is not supported by this service provider.", this);
        emit error(reply, reply->error(), reply->errorString());
        return reply;
    }

    QString requestString = "http://";
    requestString += m_host;
    requestString += "/geocoder/rgc/2.0?referer=" + m_referer;
    if (!m_token.isNull())
        requestString += "&token=" + m_token;

    if (!m_applicationId.isEmpty()) {
        requestString += "&app_id=";
        requestString += m_applicationId;
    }

    requestString += "&long=";
    requestString += trimDouble(coordinate.longitude());
    requestString += "&lat=";
    requestString += trimDouble(coordinate.latitude());

    requestString += "&lg=";
    requestString += languageToMarc(locale().language());

    return search(requestString, bounds);
}
Ejemplo n.º 2
0
QGeoSearchReply* QGeoSearchManagerEngineCm::reverseGeocode(const QGeoCoordinate &coordinate,
        QGeoBoundingArea *bounds)
{
    if (!supportsReverseGeocoding()) {
        QGeoSearchReply *reply = new QGeoSearchReply(QGeoSearchReply::UnsupportedOptionError, "Reverse geocoding is not supported by this service provider.", this);
        emit error(reply, reply->error(), reply->errorString());
        return reply;
    }

	// Prepare request url for ReverseGeocoding:

//	QString requestString = "http://" + m_host + "/" + m_token +"/geocoding/v2/find.js?around=51.51384,-0.10952&distance=closest";
	QString requestString = "http://" + m_host + "/" + m_token +"/geocoding/v2/find.js?around=";
	requestString += QString::number(coordinate.latitude());
	requestString += ",";
	requestString += QString::number(coordinate.longitude());
	//requestString += "&zoom=18";
	requestString += "&distance=closest";
	requestString += "&return_location=true";

    return search(requestString, bounds);
}