Using Location Sensor and Cloud DB for a marker app

Hello! My app is about reporting invasive species to a map with different sightings being markers. I've been working on this app and I need help on how to make a certain part. What I want this section of the app to do is this:
Already done:

  • Can go to the report screen, choose a species, and start filling out specifics.

Help:

  • How to Use Location sensor and Cloud DB to create multiple markers (mostly unlimited amount) based on where you are/where you are reporting from. Place these markers on the map and save it (the markers or the coordinates of the marker itself) to cloud DB so that every time you open the map (map screen) the markers from your previous reports will stay there. I've tried many attempts at using different logic, most of which didn't succeed. Any help at all would be helpful Thanks!

Welcome to the community.

Have you done this tutorial
How to broadcast a GPS location and share the information on a map with others in real time..CloudDB ?

Part of what you need to do might be covered somewhere in the tutorial.

or perhaps this this example: Social Distancing ... a CloudDB / Location Marker Tutorial

It seems what you might need to do is accumulate a List of geocoordinates and store them (in a TinyDB or in the CloudDB itself, then post the locations on a Map using a runtime Marker . The basic required code would look something like this::


What you do depends on what you already coded and whether you add coordinates using the LocationSensor or by capturing them by touching the Map.

Here is a tutorial showing essentially how it can be done using a Google sheet and an extension; however you do not need the extension as mentioned in the tutorial. All can be done with the regular LocationSensor in a similar fashion ... see HOW TO: use LocationService extension with a GoogleSpreadsheet to record real time locations while the app is in the background

Ok Thanks! I will look at the tutorials and the code you posted and try to improve it. If It doesn't work I might reply to this post again, This helps a lot!

1 Like

I used the help you gave me and I got some progress but got stumped. It only shows one marker on the map for some reason. I feel like it is a small problem but I feel as though I should ask before proceeding to try and fix it because I do not want to mess up the correct code. Here are the blocks of code that I have to produce one marker:

The Screen Before the Map screen:

The Actual Map Screen:

Thanks!

Really only one Marker. Could another be hiding behind another because of the map zoom setting? The Markers may appear as one if your coordinates do not vary a lot between setting them to the latest location.

After you save the coordinates or after you generate the Marker? Only save a List of coordinates to the CloudDB; do not save Marker 'names'. Generate the runtime Markers from the List you store then retrieve from the CloudDB

If you save a copy of your Project, messing up should not be a problem ; you will have a back up. Experiment all you want after you create a copy (either Projects>Save project as.. or create an aia copy).

Using multiple Screens with a Project like this is complex; recommend you use virtual screens to avoid timing issues but multiple Screens do work. :cry:

2 Likes

Hello! I changed my code a bit because I think I wasn't saving the coordinates to cloud DB successfully. I have come across an error though and I do not know what is causing it. Sorry if this is very bothersome at all..

The New Code for the screen before the map: (you might have to zoom in)

The Error I am getting:

Thanks!

Sorry, I haven't a clue.
What I know from your code and error message:

  • the key word in the error message is 'Irritants'; usually this surfaces when using the ios Companion and something fails. Are you using ios, not Android Companion?

  • the error possibly occurs when you attempt to Initialize Screen2. Here you define the tag list as Text, the valueIfTagNotThere should be an empty List.
    listTag

  • your EnableLoc Button ?? event handler supposes the LocationSensor has achieved a satellite fix; it may not have saved and that is causing issues. Use the DoIt debugger.

  • I don't understand your use of db_Index ; this may be where your issue is. If you are using it in an attempt to identify each geocoordinate, a better way would be to save the index in the same List you store your geocoordinates (add a third element).

I believe I nor any one else can debug this issue from the code you shared. There is insufficient information. How to debug Live Development, Testing and Debugging . There is no way to determine what Latitude, Longitude values you try to save. Using multiple Screens complicates the debugging.

If you share more code and provide a better explanation about what you are trying to achieve, someone might be able to help you. :cry: Sorry.