Unsolved How can I get my address location with qt ?
-
How can I get my adress location with qt? I want to get my home location.
-
-
my home as really :D
-
like gps,google-maps
-
Do you mean the QtLocation module ?
-
thanks for reply :D
-
@SGaist can you give me simple example code? or how can i get example this api ?
-
Here are some code snippets from a GPS tracker. For API details see QGeoPositionInfoSource and QGeoPositionInfo.
// setup GPS m_gps = QGeoPositionInfoSource::createDefaultSource(this); if (m_gps) { connect(m_gps, SIGNAL(positionUpdated(QGeoPositionInfo)), this, SLOT(positionUpdated(QGeoPositionInfo))); m_gps->startUpdates(); } void MainWindow::positionUpdated(const QGeoPositionInfo &info) { if (!info.isValid()) { ui->mainPage->setStatusText( "Invalid GPS data" ); return; } if (m_appState == AppState::NoGps) { ready(); } // set current data on main page ui->mainPage->currentSetLatitude( QString("%1").arg(info.coordinate().latitude(), 0, 'f', 5) ); ui->mainPage->currentSetLongitude( QString("%1").arg(info.coordinate().longitude(), 0, 'f', 5) ); ui->mainPage->currentSetAltitude( QString("%1").arg(info.coordinate().altitude(), 0, 'f', 0 ) ); if (m_appState == AppState::Running) { const int pointsCount = m_sessionInfo->path.size(); if (pointsCount == 0) { m_sessionInfo->path << info; } else { const double lat1 = m_sessionInfo->path.at( pointsCount-1 ).coordinate().latitude(); const double lon1 = m_sessionInfo->path.at( pointsCount-1 ).coordinate().longitude(); const double lat2 = info.coordinate().latitude(); const double lon2 = info.coordinate().longitude(); double distance = gpsDistance(lat1, lon1, lat2, lon2); if (distance > DISTANCETHRESHOLD) { m_sessionInfo->distance += distance; m_sessionInfo->path << info; } } } }
-
@takoo If you are using the ArcGIS SDK, you can do it with geocoding. It is discussed here - https://developers.arcgis.com/qt/qml/guide/search-for-coordinates.htm
Otherwise, does the example in Qt Location not give you what you need (sounds like you need to Geocode) - http://doc.qt.io/qt-5/qtlocation-mapviewer-example.html