# Bearing from destination

**URL:** <https://community.qfield.org/t/bearing-from-destination/581>\
**Category:** Ask the Community\
**Tags:** gh-import\
**Created:** [14 May 2025 02:36 UTC](https://community.qfield.org/t/bearing-from-destination/581 "2025-05-14T02:36:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://europe1.discourse-cdn.com/flex018/uploads/qfield/original/1X/7d3726da0ef5099a1e135505c03d2f125d527aae.png) [@system](https://community.qfield.org/u/system)\
**Post date:** [14 May 2025 02:36 UTC](https://community.qfield.org/t/bearing-from-destination/581/1 "2025-05-14T02:36:42Z")

</div>

I’m using QField to collect viewpoint location and orientation data and I’d like to have the destination bearing recorded as an attribute for a survey point. Of course I can do this manually, but can someone help with the expression coding for the default value in a widget to achieve this? I’m using this approach because the in-built compass in my mobile phone is completely unreliable. I’d also be really interested if someone can think of another approach.

* * *

_Imported from [GitHub discussion](https://github.com/opengisch/qfield/discussions/4457) by @NigelCowlin on 2023-07-19T11:14:57Z_

---

<div class="post-metadata">

**Author:** ![system](https://europe1.discourse-cdn.com/flex018/uploads/qfield/original/1X/7d3726da0ef5099a1e135505c03d2f125d527aae.png) [@system](https://community.qfield.org/u/system)\
**Post date:** [14 May 2025 02:36 UTC](https://community.qfield.org/t/bearing-from-destination/581/2 "2025-05-14T02:36:43Z")

</div>

Do you mean the bearing from your current location to the subject of the viewpoint? if so you need the destination as a variable and the expression would be something like the one below depending on your required output. I used to do this once back in the office.  
(atan2((TargetX-$x),(TargetY-$y)))\*57.295779513082320876798154814105

* * *

_Imported from [GitHub comment](https://github.com/opengisch/QField/discussions/4457#discussioncomment-6592131) by @BTreeTech on 2023-07-31T07:54:17Z_
