# Map crashes when adding markers from data source

**URL:** https://community.thunkable.com/t/map-crashes-when-adding-markers-from-data-source/884171
**Category:** Questions about Thunkable X
**Created:** [October 8, 2020, 11:41am UTC](https://community.thunkable.com/t/map-crashes-when-adding-markers-from-data-source/884171 "2020-10-08T11:41:19Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![deepblue.wfwc](https://avatars.discourse-cdn.com/v4/letter/d/df788c/32.png) [@deepblue.wfwc](https://community.thunkable.com/u/deepblue.wfwc)
#### Post date: [October 8, 2020, 11:41am UTC](https://community.thunkable.com/t/map-crashes-when-adding-markers-from-data-source/884171/1 "2020-10-08T11:41:19Z")

</div>

I want to add points to the map from a table. My code looks like this, but when I do live preview on my phone I get an error upon opening the map.  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/f/b/fbbcbddcfa6fb4163ecee9b531073f06df9caa25.png)

 ![Screenshot_20201008-133907](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/0/40f252d66dd3fc7daba2a50eff44bddae80f0f17.png)  
Running on Android11.

---

<div class="post-metadata">

### Author: ![jared](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jared/32/138473_2.png) [@jared](https://community.thunkable.com/u/jared)
#### Post date: [October 8, 2020, 11:47am UTC](https://community.thunkable.com/t/map-crashes-when-adding-markers-from-data-source/884171/2 "2020-10-08T11:47:03Z")

</div>

Your issue is probably rooted in the fact that your row ID should be a unique string of text and not a single digit.

---

<div class="post-metadata">

### Author: ![deepblue.wfwc](https://avatars.discourse-cdn.com/v4/letter/d/df788c/32.png) [@deepblue.wfwc](https://community.thunkable.com/u/deepblue.wfwc)
#### Post date: [October 8, 2020, 11:51am UTC](https://community.thunkable.com/t/map-crashes-when-adding-markers-from-data-source/884171/3 "2020-10-08T11:51:18Z")

</div>

I tried renaming the int to string but its still crashing  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/e/a/ea1d9b1d0b830c855d25b72262125711a7b83f6a.png)

The data table looks like this:  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/2/5/25ee0fa229c82c7e7e8f524e93e583c444dcbad9.png)

---

<div class="post-metadata">

### Author: ![drted](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/drted/32/92694_2.png) [@drted](https://community.thunkable.com/u/drted)
#### Post date: [October 8, 2020, 11:51am UTC](https://community.thunkable.com/t/map-crashes-when-adding-markers-from-data-source/884171/4 "2020-10-08T11:51:41Z")

</div>

I’ve had similar problems populating a map from a datasource call (google sheets). What I found is that the data source blocks return the coordinates as STRINGs and adds quotation marks, even though the data is stored as a number. If the addMarker block is pass a values of “123” instead of 123, it will produce errors similar to your image. My solution is to convert the data source return values to numbers by adding zero.

See if that helps

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

---

<div class="post-metadata">

### Author: ![deepblue.wfwc](https://avatars.discourse-cdn.com/v4/letter/d/df788c/32.png) [@deepblue.wfwc](https://community.thunkable.com/u/deepblue.wfwc)
#### Post date: [October 8, 2020, 12:11pm UTC](https://community.thunkable.com/t/map-crashes-when-adding-markers-from-data-source/884171/5 "2020-10-08T12:11:12Z")

</div>

That was one step forward and two steps back.  
By adding 0, the map doesnt crash. but the location is in actual 0,0 location.  
Ive also tried setting the lat/long as floats with 3 decimals, but then the map crashes again.  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/2/7/27a1a94ebe98f49a8dcf49e34ba89ce3f80233ff.png)  
Is there no debug console or log anywhere I can look at?

---

<div class="post-metadata">

### Author: ![drted](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/drted/32/92694_2.png) [@drted](https://community.thunkable.com/u/drted)
#### Post date: [October 8, 2020, 12:26pm UTC](https://community.thunkable.com/t/map-crashes-when-adding-markers-from-data-source/884171/6 "2020-10-08T12:26:37Z")

</div>

I just discovered about an hour ago that the block “…with…decimal places” also converts number to strings. ARGH!!!

Another technique I have used to get around problematic Thunkable data typing is to store the value in a variable So the process becomes:

1. Set local variable = data source values
2. set local variable = local variable + 0
3. Pass local variable into block

Since this is a data type issue, I would recommend that, for debugging, set the text property of a label to the variable and see if the quotation marks are present (or if the data source actually returned the value you were expecting). This can save a lot of time (and crashes).

Here is an example of a block I use for debugging

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

Good luck!

---

<div class="post-metadata">

### Author: ![deepblue.wfwc](https://avatars.discourse-cdn.com/v4/letter/d/df788c/32.png) [@deepblue.wfwc](https://community.thunkable.com/u/deepblue.wfwc)
#### Post date: [October 8, 2020, 3:36pm UTC](https://community.thunkable.com/t/map-crashes-when-adding-markers-from-data-source/884171/8 "2020-10-08T15:36:42Z")

</div>

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/c/0c41d956fdba45e124f99692ac91e9b7be518f7d.png)  
If I assign longitude to a variable, the lable displays “undefined” in the app. (1)  
But in (2) I can get the value of latitude straight from the data source.  
Am I not initializing the variable correctly?

---

<div class="post-metadata">

### Author: ![drted](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/drted/32/92694_2.png) [@drted](https://community.thunkable.com/u/drted)
#### Post date: [October 8, 2020, 5:27pm UTC](https://community.thunkable.com/t/map-crashes-when-adding-markers-from-data-source/884171/9 "2020-10-08T17:27:17Z")

</div>

The problem appears to be with retrieving data from outlet\_locations, not with the map. When a value says undefined, that the variable has not been set, or is some sort of unexpected value.

What type of data source is outlet\_locations? The value of 1 (or “1”) is not necessarily the row number in the sheet. I THINK the row number can be used with google sheets, but I haven’t tried airtable or local DB for a long time.

---

<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, 12:23pm UTC](https://community.thunkable.com/t/map-crashes-when-adding-markers-from-data-source/884171/10 "2024-11-08T12:23:35Z")

</div>


