# How do I make my app only send location data if it is different (lat and long)

**URL:** https://community.thunkable.com/t/how-do-i-make-my-app-only-send-location-data-if-it-is-different-lat-and-long/1980371
**Category:** Maps
**Created:** [July 30, 2022, 1:34am UTC](https://community.thunkable.com/t/how-do-i-make-my-app-only-send-location-data-if-it-is-different-lat-and-long/1980371 "2022-07-30T01:34:16Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![leviocsmithk](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/leviocsmithk/32/136645_2.png) [@leviocsmithk](https://community.thunkable.com/u/leviocsmithk)
#### Post date: [July 30, 2022, 1:34am UTC](https://community.thunkable.com/t/how-do-i-make-my-app-only-send-location-data-if-it-is-different-lat-and-long/1980371/1 "2022-07-30T01:34:16Z")

</div>

So far I have gotten my app to send the users location data to a google docs sheet and record that data and put it on google maps, the problem i have is that. If i stay in the same place it keeps filling up my google docs with the same long and lat data which I don’t need until the User moves.

I am thinking something which will detect if the Lat and Long are the same and if so don’t send that data, but i am unsure how I would be able to do this.

Any help would be greatly appreciated.

Here are some screenshots of what i have so far.

 ![Screen Shot 2022-07-30 at 11.33.42 am](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/2/c/2c18f160143904e18df34fcb07c0f7330b569138.png)

 ![Screen Shot 2022-07-30 at 11.33.32 am](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/9/7/97836baa1cde821359f2d5d16e7b7bac235beece.png)

---

<div class="post-metadata">

### Author: ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)
#### Post date: [July 30, 2022, 2:22am UTC](https://community.thunkable.com/t/how-do-i-make-my-app-only-send-location-data-if-it-is-different-lat-and-long/1980371/2 "2022-07-30T02:22:26Z")

</div>

When you get the user’s location, store the lat and long as variables (or join them into a single text string in a variable). If the current location from the sensor does not equal the stored variable location, then store it in the spreadsheet.

Or if you want to avoid extra variables, check the last row of the spreadsheet against the current sensor values and if it’s different, store it in the spreadsheet.

---

<div class="post-metadata">

### Author: ![leviocsmithk](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/leviocsmithk/32/136645_2.png) [@leviocsmithk](https://community.thunkable.com/u/leviocsmithk)
#### Post date: [July 30, 2022, 3:01am UTC](https://community.thunkable.com/t/how-do-i-make-my-app-only-send-location-data-if-it-is-different-lat-and-long/1980371/3 "2022-07-30T03:01:22Z")

</div>

Can you send me a screenshot of how you would do that please.  
Many Thanks, Levi

---

<div class="post-metadata">

### Author: ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)
#### Post date: [July 30, 2022, 3:48am UTC](https://community.thunkable.com/t/how-do-i-make-my-app-only-send-location-data-if-it-is-different-lat-and-long/1980371/4 "2022-07-30T03:48:57Z")

</div>

I don’t have that all set up but basically you would add a condition to your “create row” block that says if app variable lastLat ≠ [green latitude block] AND app variable lastLong ≠ [green longitude block] then… create row. Inside the “create row” block’s “do” section, set app variable lastLat to [green latitude block] and set app variable lastLong to [green longitude block].

If that doesn’t work, post a screenshot of your blocks and someone can help you fix them.

---

<div class="post-metadata">

### Author: ![leviocsmithk](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/leviocsmithk/32/136645_2.png) [@leviocsmithk](https://community.thunkable.com/u/leviocsmithk)
#### Post date: [July 30, 2022, 5:08am UTC](https://community.thunkable.com/t/how-do-i-make-my-app-only-send-location-data-if-it-is-different-lat-and-long/1980371/5 "2022-07-30T05:08:47Z")

</div>

Thanks I will test this out.

---

<div class="post-metadata">

### Author: ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)
#### Post date: [July 30, 2022, 12:46pm UTC](https://community.thunkable.com/t/how-do-i-make-my-app-only-send-location-data-if-it-is-different-lat-and-long/1980371/6 "2022-07-30T12:46:50Z")

</div>

I have created this for you in another post

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/6/1/61e02da5d7d384febb5b106e3bbcda65c64ba5df.png)

Basically check if it is the same user. If true, update the same row, if a different user then create a row for that user.

---

<div class="post-metadata">

### Author: ![leviocsmithk](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/leviocsmithk/32/136645_2.png) [@leviocsmithk](https://community.thunkable.com/u/leviocsmithk)
#### Post date: [July 30, 2022, 10:23pm UTC](https://community.thunkable.com/t/how-do-i-make-my-app-only-send-location-data-if-it-is-different-lat-and-long/1980371/7 "2022-07-30T22:23:57Z")

</div>

Sorry I can’t get it to work can you send a screenshot of what you did, this would be greatly appreciated.

---

<div class="post-metadata">

### Author: ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)
#### Post date: [July 30, 2022, 10:42pm UTC](https://community.thunkable.com/t/how-do-i-make-my-app-only-send-location-data-if-it-is-different-lat-and-long/1980371/8 "2022-07-30T22:42:53Z")

</div>

> [@tatiang](#):
>
> If that doesn’t work, post a screenshot of your blocks and someone can help you fix them.

Sorry for the back and forth but I expect you to post what you’ve tried. Otherwise, I’m just doing all the work for you. I assume you’ve spent time on this so why ask me to spend time to make the same thing? I can probably see pretty quickly what’s wrong if I can see your blocks.

---

<div class="post-metadata">

### Author: ![manyone](https://avatars.discourse-cdn.com/v4/letter/m/ee59a6/32.png) [@manyone](https://community.thunkable.com/u/manyone)
#### Post date: [July 31, 2022, 1:59am UTC](https://community.thunkable.com/t/how-do-i-make-my-app-only-send-location-data-if-it-is-different-lat-and-long/1980371/9 "2022-07-31T01:59:24Z")

</div>

you should also consider this in your calcuation.

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/d/7/d7b2de7a3d2e02ca1a9d0b2c9dff2adfa410c53e.png)

that’s why i’m surprised at your google sheet - if it shows the exact same coordinates, the thing you are tracking must be absolutely still. if you’re using thunkable’s location sensor (i don’t know it’s accuracy), you should be getting different coordinates in the 6th digit after the decimal position everytime you move around 4 inches!  
i suggest you use the absolute value of the difference between the truncated values (to the 4th digit) of the latitudes and longitudes and if both values are zero, the object you’re tracking hasn’t “moved” outside 11.1x11.1 meter area.

hence these 2 points are considered the “same location”  
-26.6807999 153.0837111 to  
-26.6807000 153.0837876

EDIT - you better change that precision to 3rd digit after the decimal point.  
i wrote a little “exerciser” of the location sensor

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/8/9/897b495dbea9f29712644bcf55c127ebee184cf4.png)

and found out that even turning 90 degrees while i’m on my swivel chair gives me a big enough difference:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/1/e/1e58e0ec359fe4c4c5442fd430fe1468ae7db522.png)

here’s a link to my exerciser (see screen 6)  
[https://x.thunkable.com/copy/b27c41fcbe4f3c3eb31d52afd71910bc](https://x.thunkable.com/copy/b27c41fcbe4f3c3eb31d52afd71910bc)

---

<div class="post-metadata">

### Author: ![leviocsmithk](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/leviocsmithk/32/136645_2.png) [@leviocsmithk](https://community.thunkable.com/u/leviocsmithk)
#### Post date: [July 31, 2022, 2:43am UTC](https://community.thunkable.com/t/how-do-i-make-my-app-only-send-location-data-if-it-is-different-lat-and-long/1980371/10 "2022-07-31T02:43:06Z")

</div>

I don’t really understand your first post about Setting up the rows etc.

Sorry, I am not trying to make you do all the work I’m just new to Thunkable.

This is what I have so far.

 ![Screen Shot 2022-07-31 at 12.42.54 pm](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/c/4c3ba3ec86c8d95071ab55ff0580c7db32919a72.png)

Mant Thanks Levi

---

<div class="post-metadata">

### Author: ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)
#### Post date: [July 31, 2022, 5:37am UTC](https://community.thunkable.com/t/how-do-i-make-my-app-only-send-location-data-if-it-is-different-lat-and-long/1980371/11 "2022-07-31T05:37:09Z")

</div>

Here’s how I would set it up:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/6/c/6cdca7e2d9d3a5a19149cc637dd0def2dc3b702f.png)

Note that my `create row` block is using a table that doesn’t have UserLat and UserLong values but you would attach the green `latitude` and `longitude` blocks to those just as in your screenshot above.

There’s a chance that you might have to initialize the two variables to actual values (e.g. 0) but I think it will work the way I have it here.

---

<div class="post-metadata">

### Author: ![leviocsmithk](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/leviocsmithk/32/136645_2.png) [@leviocsmithk](https://community.thunkable.com/u/leviocsmithk)
#### Post date: [July 31, 2022, 8:17am UTC](https://community.thunkable.com/t/how-do-i-make-my-app-only-send-location-data-if-it-is-different-lat-and-long/1980371/12 "2022-07-31T08:17:48Z")

</div>

Thank you so much, really appreciated

This now works thanks for your help.

---

<div class="post-metadata">

### Author: ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)
#### Post date: [July 31, 2022, 5:35pm UTC](https://community.thunkable.com/t/how-do-i-make-my-app-only-send-location-data-if-it-is-different-lat-and-long/1980371/13 "2022-07-31T17:35:34Z")

</div>

You’re welcome! You can mark my post as the solution so others know that solved it.

---

<div class="post-metadata">

### Author: ![leviocsmithk](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/leviocsmithk/32/136645_2.png) [@leviocsmithk](https://community.thunkable.com/u/leviocsmithk)
#### Post date: [July 31, 2022, 9:13pm UTC](https://community.thunkable.com/t/how-do-i-make-my-app-only-send-location-data-if-it-is-different-lat-and-long/1980371/14 "2022-07-31T21:13:10Z")

</div>

Ok sounds Good.

---

<div class="post-metadata">

### Author: ![leviocsmithk](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/leviocsmithk/32/136645_2.png) [@leviocsmithk](https://community.thunkable.com/u/leviocsmithk)
#### Post date: [July 31, 2022, 9:13pm UTC](https://community.thunkable.com/t/how-do-i-make-my-app-only-send-location-data-if-it-is-different-lat-and-long/1980371/15 "2022-07-31T21:13:37Z")

</div>

Ok Sounds Good, Thanks For your Help.

---

<div class="post-metadata">

### Author: ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)
#### Post date: [November 8, 2024, 1:13pm UTC](https://community.thunkable.com/t/how-do-i-make-my-app-only-send-location-data-if-it-is-different-lat-and-long/1980371/16 "2024-11-08T13:13:00Z")

</div>


