Hi,
I am totally new in developing apps with the AppStudio and qml, so hopefully the questionis not too easy.
I want to calculate the distance and the azimuth (bearing) from my current (gps)-position to a point on the map.
What i already did:
I added a positionDisplay to my map.
positionDisplay {
compass: Compass {
id: compass
active: true
// Create a variable to hold azimuth
property double azimuth: 0
// Change sensor axis depending on 'userOrientation' property
axesOrientationMode: Compass.UserOrientation
onReadingChanged: {
// Called when a new compass reading is available
compass.azimuth = reading.azimuth; //Or better Call it when Reading is available? //geoResult = locationPoint.geodesicDistance(toPoint);
}
}
positionSource: PositionSource {
id: positionSource
active: true
onPositionChanged: {
locationPoint.valid = position.longitudeValid && position.latitudeValid
locationPoint.x = position.coordinate.longitude;
locationPoint.y = position.coordinate.latitude;
geoResult = locationPoint.geodesicDistance(toPoint);
locationPointChanged();
}
}
} The points are set like this property Point locationPoint : Point {property bool valid : falsespatialReference: SpatialReference {wkid: 4326}
}
property Location toPoint :Location{coordinate {latitude: 55.314835longitude: 8.458156}
} I thought I could use the GeodesicDistanceResult to get distance and azimuth, but it didn't worked. GeodesicDistanceResult{id:geoResult} like in my "onPositionChanged" geoResult = locationPoint.geodesicDistance(toPoint) so what's wrong or how do i have to use it? Thanks in advance! Thomas
Maybe this will help get you on the right track - RuntimeQtSamples/main.qml at master · ldanzinger/RuntimeQtSamples · GitHub