# GPS location giving wrong positions

**URL:** <https://forum.legato.io/t/gps-location-giving-wrong-positions/5648>\
**Category:** Uncategorized\
**Created:** [March 10, 2021, 6:19am UTC](https://forum.legato.io/t/gps-location-giving-wrong-positions/5648 "2021-03-10T06:19:47Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![ClaudioBaldo](https://avatars.discourse-cdn.com/v4/letter/c/b9bd4f/32.png) [@ClaudioBaldo](https://forum.legato.io/u/ClaudioBaldo)\
**Post date:** [March 10, 2021, 6:19am UTC](https://forum.legato.io/t/gps-location-giving-wrong-positions/5648/1 "2021-03-10T06:19:47Z")

</div>

I am using the GNSS location service for the FX30S and occasionally the signal drop out.  
The le\_gnss\_GetLocation() will return:  
latitude: -27  
longitude: 133  
which is the exact central position of australia, no decimal points.

In my code, before printing the position I check:  
// Get position state  
result = le\_gnss\_GetPositionState(positionSampleRef, &state);  
if(state == LE\_GNSS\_STATE\_FIX\_NO\_POS)  
{  
le\_gnss\_ReleaseSampleRef(positionSampleRef);  
return;  
}

how can I check if a position is a valid one or the GNSS has lost signal?

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [March 10, 2021, 6:26am UTC](https://forum.legato.io/t/gps-location-giving-wrong-positions/5648/2 "2021-03-10T06:26:32Z")

</div>

have you compared with aT!GPSLOC?

---

<div class="post-metadata">

**Author:** ![ClaudioBaldo](https://avatars.discourse-cdn.com/v4/letter/c/b9bd4f/32.png) [@ClaudioBaldo](https://forum.legato.io/u/ClaudioBaldo)\
**Post date:** [March 10, 2021, 6:28am UTC](https://forum.legato.io/t/gps-location-giving-wrong-positions/5648/3 "2021-03-10T06:28:47Z")

</div>

I am not using AT commands, I am running the gnss API function so I would need to know this from the code, possibly using any of the gnss functions

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [March 10, 2021, 6:40am UTC](https://forum.legato.io/t/gps-location-giving-wrong-positions/5648/4 "2021-03-10T06:40:01Z")

</div>

I mean you can compare with the value you obtained with AT!GPSLOC and see if it is valid.

Or have you tried with “gnss get posInfo”?

---

<div class="post-metadata">

**Author:** ![ClaudioBaldo](https://avatars.discourse-cdn.com/v4/letter/c/b9bd4f/32.png) [@ClaudioBaldo](https://forum.legato.io/u/ClaudioBaldo)\
**Post date:** [March 10, 2021, 6:45am UTC](https://forum.legato.io/t/gps-location-giving-wrong-positions/5648/5 "2021-03-10T06:45:44Z")

</div>

which function is that one exactly?  
Can`t see anything else then le\_gnss\_GetPositionState()

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [March 10, 2021, 7:06am UTC](https://forum.legato.io/t/gps-location-giving-wrong-positions/5648/6 "2021-03-10T07:06:04Z")

</div>

> <https://github.com/legatoproject/legato-af/blob/master/apps/tools/gnss/gnss.c>

---

<div class="post-metadata">

**Author:** ![ClaudioBaldo](https://avatars.discourse-cdn.com/v4/letter/c/b9bd4f/32.png) [@ClaudioBaldo](https://forum.legato.io/u/ClaudioBaldo)\
**Post date:** [March 10, 2021, 7:18am UTC](https://forum.legato.io/t/gps-location-giving-wrong-positions/5648/7 "2021-03-10T07:18:14Z")

</div>

those info are all exposed with other functions, in this specific case calling the le\_gnss\_GetPositionState() is returning a physical position, even if I know that is not correct as it points to central australia.  
Function is returning LE\_OK or I will not print the value, so I was asking which function will actually tell me if that position is accurate, or the GNSS location will not know it?  
Problem could be with the settings? Like the sampling time?

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [March 10, 2021, 7:36am UTC](https://forum.legato.io/t/gps-location-giving-wrong-positions/5648/8 "2021-03-10T07:36:50Z")

</div>

That is why you can try “gnss” command and see if that is your program problem.  
If “gnss” command has problem, then you can try AT command and see if this is legato problem.

---

<div class="post-metadata">

**Author:** ![ClaudioBaldo](https://avatars.discourse-cdn.com/v4/letter/c/b9bd4f/32.png) [@ClaudioBaldo](https://forum.legato.io/u/ClaudioBaldo)\
**Post date:** [March 10, 2021, 7:55am UTC](https://forum.legato.io/t/gps-location-giving-wrong-positions/5648/9 "2021-03-10T07:55:20Z")

</div>

so you suggest to trigger an AT command from the C source through dev, then to parse the reply and to match the result with what I am reading using the le\_gnss\_GetPositionState?

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/jyijyi/32/822_2.png) [@jyijyi](https://forum.legato.io/u/jyijyi)\
**Post date:** [March 10, 2021, 7:56am UTC](https://forum.legato.io/t/gps-location-giving-wrong-positions/5648/10 "2021-03-10T07:56:31Z")

</div>

just an idea or method to let you know where is the problem is.

---

<div class="post-metadata">

**Author:** ![ClaudioBaldo](https://avatars.discourse-cdn.com/v4/letter/c/b9bd4f/32.png) [@ClaudioBaldo](https://forum.legato.io/u/ClaudioBaldo)\
**Post date:** [March 10, 2021, 8:01am UTC](https://forum.legato.io/t/gps-location-giving-wrong-positions/5648/11 "2021-03-10T08:01:40Z")

</div>

@jyijyi many thanks for your feedback, I think I will wait to see if I get any other reply from someone who has worked with the GPS positioning service.
