Put a marker on map from Airtable

I have been trying for days to get this to work with no joy so I was hoping someone could come to my rescue.

I have an airtable sheet that has some columms including Latitude and Longitude. I would like to plot those as markers on a map once the app starts. I have gone over all of the tutorials, videos and all the different code blocks I could find and have not had success.

Trying to iterate over the sheet does not put the markers on the map. Sometimes it crashes and sometimes not but still not location markers.

I am really at my wits end trying to get this to work. Any help would be greatly appreciated.

I know Jane (a thunkable employee) had this as a tutorial but it crashes the app when launching. I have tried many variations of that but they do not work. This is the link to her tutorial (Airtable Map (show image when Marker pressed))

Hello @dpalusak,

At a glance
Try removing the Airtable “GetRow” block from the “for each” block and use only the “addMarker” block. You will also need to swap the “value” block for the variable “j” block.

As is, you are telling it get a row for every row and trying to pull the row number from the latitude property found inside the longitude property (which doesn’t exist).

Remember to always comb over your own project carefully when following a tutorial to ensure you haven’t missed the little things -

Let me know if this doesn’t fix it and I will dig deeper for you!

@DuMonster,

Thanks for your reply, I really appreciate it. I tested what you suggested and the app crashes at launch both from the live test and installing the app to my phone. Here is the screenshot of my blocks after changing it.

Screenshot from 2020-09-22 12-14-51

@dpalusak
In your Airtable DB do you have you Latitude and Longitude fields set to # numbers or Text?
de8719f8ae72cb0773e3a36ec34e2fb59e29c789_2_690x168

1 Like

The are both set to # numbers.

And your column names match your get Property blocks?

Yes they match.

I’d suggest you do a bit of error hunting. Add a label to your design and before the j-loop add an if error display error block. Then you’ll know if the problem is with getting the rows or adding the data to the map.
Then I’d use a very basic version of the Airtable (two or three rows) and test that.
Note that if any of your rows have empty latitude or longitude cells attempting to get that property will fail and the app will crash (because the property doesn’t exist). Empty rows will cause the same problem.
If having empty cells is unavoidable, you’ll need an error protection routine that gets the properties of j, checks if the required property exists and only gets it if it exists.
Hope that helps.

1 Like

@shane.holohan1864qsw,

I added a display error block and label and they were coming up null when testing. Then I re-read what you said about empty rows crashing the app. After checking my airtable, I noticed that there was an empty blank row at the bottom of my sheet. Once I deleted that row and tested it worked!!! I can’t thank you all enough for helping me troubleshoot and fix this!

Many thanks!
Dan

3 Likes

@DuMonster,

Thanks for you help working with me to get this resolved!

2 Likes

Now I just need to implement the blocks so it doesn’t crash if there is an extra empty row.

1 Like

Check 1 cell from each row

You could check for a value being present or length of characters in a cell needs to be over 1 or some other method to ensure there is data in the cell

@Jared_Gibb,

Do you have any blocks examples of this? I am thinking through it but can not seem to come up with the logic. I am not sure of which blocks will get me this check. It would actually have to check all rows for data, correct?

Thanks

Here I call an api. Split the response into lists. Then run a loop over the lists and add a marker each time. On my iPhone 100 markers every 5-7 Took approximately .5-.75 sec

@Jared_Gibb,

Here is what I have so far. The app doesn’t crash but I don’t get any markers either. There really only individual cells that will be blank at this point and not necessarily an entire row although I guess that could be the case at some point.

Here is another one I tried based on one of your examples for " How to query data from airtable". The app is not crashing which I guess is good:) but still no markers.

do you have an airtable with coordinates in it already?

can you share one with me? that would make this easier on my end. I can put together an example and have it for you probably tomorrow!

I would greatly appreciate that!

I do have a test sheet that I can share with you. How should I do that? By inviting you by email? If so, what address should I use?

jared.gibb@gmail.com

I just sent the email invite for the table.

Thanks again Jared!!