Retrieving GPS data from Firebase DB

If you have a rough idea of how many markers you need it may be easier to create all of these at the design stage, and set them all to not visible, put them in a list, and use them as needed (changing their visibility.

You can create runtime markers (as long as you have at least one design time marker), these would need to be added to a list when created, and can be more complex to manage.

Ok thank you. What if I wanted to target pull in only the most recent timestamped coordinates from my database? For example, I just push the button and it bypasses me having to pick out which data I want from the list and instead it just pulls the most recent coordinates and displays the map and marker. Is there a way to adjust the code you provided to do that?

Yes, there are two or three ways you could do this. See if you can work out a solution, based upon what has been done for you already....

I am still stuck on filtering the data. I want to effectively eliminate the list of timestamped data that is displayed and have it so that it just shows the most recent GPS coordinates from my database on the map. Like, no need to pick anything it just automatically loads the most recent coordinates and displays them. I feel that even though what I have works at the moment, it is cumbersome to force the end user to have to scroll through what could be a very long list of data in order to get what we are really interested in. My difficulty is that I don't really know what blocks to use in order to make this happen. My first though was to change the tag of "ListView1.Selection" to something else, but I don't know what to change it to.

1 Like

You could do something like this:

mapLoadMarkers.aia (4.7 KB)

How are you getting the "Set Marker.Description of component" blocks towards the end? When I open my marker menu I see a "Set Marker.Description to", but nothing with "of component".

Nevermind I think I found it.

I am currently getting this error when using the code you provided above. Any ideas on how to correct it?

Edit: I was able to adjust the index values so that it is looking at latitude and longitude, but it still isn't seeing the actual values for those quantities. So I need to find a way to dig deeper into where it is looking and make it so that it just reads the raw values, but I have no idea on how to do that.

It is because you are using the values from the output list, not the values returned from the taglist. My values were not key/value pairs.

Look at my exaample again, and see what data is being saved.

I'm sorry, but I don't know if I follow. I copied your code exactly. Does this have something to do with the way my database is set up that I need to adjust or can it be corrected within the code itself?

Yes, just looking back at previous work here, your database contains key/value pairs. You will need to add another select item block to select the second item from the list returned

So something like this?

That is the idea. Does it work now ?

With that specific structure and those index values it throws me a similar error to before. I just kinda guessed at the index values, so I'm thinking it might be tied to that. Would adding dictionary blocks like in the original example you provided be of any use?

Should look like this:

example value:

image

Ok so it is getting past the error now, but it is still not filtering out everything but the most recent timestamped data. Also, within the popup bubble it is only displaying the information on pressure. This is nice, but ideally I would like to have all the data we are collecting display.

I have included images of how we have our database structured. What we ultimately want is to have 4 separate sensors pulling in data and then the app will go in and read in the data and display the most recent information on the map. The GPS coordinates would obviously be used to determine the location of the 4 markers and then within the popup bubble we would see everything else displayed (pressure, humidity, GPS, temperature, etc.) I apologize for asking so many questions, I am just very new to programming and on a time-crunch to get basic functionality up and running.

I tried out the app you included in one of your posts and it is quite close to what we are aiming for, I just want to know how to have it correctly read from our database rather than entering in the coordinates manually within the code itself.

The overall structure:

Screenshot (19)

An example of what each timestamped entry looks like (this is what I would like to see within the popup of the marker)

Code I have so far:

Really appreciate all the help you have provided so far.

OK, we need to take a couple of steps backwards, then a couple of new steps forward. Give me a short while....

See this:

image

mapLoadMarkers.V2.aia (6.3 KB)

You will see that the data (key/value pairs) in indexes 1,4 and 5 are selected and displayed in the infobox. You can expand the join block to include all of your data.

Now we have reached this stage, and I see you have added new sensors, in order to reduce the number of calls to firebase each time you want to display the markers, it may be better to "start again", call in all the data in /sensor1 and use dictionaries to organise the data. However, because you keep iterating and keep adding "one more thing" each time you get a solution, it may be better to wait until you have finished adding new requirements, then it may be possible to find a more efficient method.

Side question: Is it possible to have my code designed so that an element is automatically chosen from a listpicker component? For example, if I have my timestamped data displaying in such a component would it be possible to have a specific element shown chosen automatically (such as the last element) rather than having the user select it manually and then using an afterPicking block to have it do something with that chosen list element? If so, how would you go about targeting a particular element and selecting it automatically?

How will you decide which dataset will be shown?