Delete specific markers on map

I am using the map to track pets. Each marker that is placed down is a pet’s location and when I get an updated location of their whereabouts, I have to delete all the markers to update one pets location. I’ve temporarily found one way around this without having to delete specific blocks. I have to set the location variable for each pet and then update each pet’s location every time there is a change. It’s a lot of unnecessary blocks and I also can only have as many pets as there are variables that I set up beforehand. It would be nice to have the option to track as many pets as I want without having to set a variable for each pet. One variable should be enough.

Care to share how you update a single marker ?

If you’re using many variables to store the same type of information, then you really should be using a list instead and storing that list (which is dynamic in size) in a single variable.

2 Likes

Right now, this is how I update a single marker. I only have the option for one pet atm. They also have a choice of which kind of map layer they want to use.

I’ve thought about that, I’m just not sure how to go about doing that. I’ve also thought about using an object in a list for the Coordinates, but I’m not sure how to go about updating objects that are nested in a list or objects that are assigned to a pet name in a list.

Right now this is how I have everything set up:

  • The phone receives data from the receiver which receives its from the pets harness.
  • I use a space as the delimiter to get information at certain spots in the data string.
    1. Harness ID
    2. Lattitude
    3. Longitude
    4. Harness battery life
    5. Satellites in view
    6. Horizontal dilution of precision (Hdop)
    7. Power mode (live tracking, power saving mode, extreme psm)
    8. Light status (bool if the light is on or off)
    9. Color choice (color of the light if it is on)
    10. Signal Strength of the harness to the receiver (RSSI)
  • The data stored in a list called temp list
  • Then rewritten when the phone gets an update from the receiver.

The values I would like to store are the Coords for each pet that way if there is a loss in power or disconnection from the receiver it will have the pets last location. I just need to update the rest of the data but not store it. Each pet will have their own unique Harness ID, and that’s how I tell them apart.

I guess my thought process was if that data coming into the phone had a different harness ID, then it would just delete the marker with that harness ID. But I guess long term for what I’m wanting to do, it would be better to store all that data in a list for each pet somehow.

If you more than one or two categories of data (you have ten), then you should be using a Data Source, not a list and not a bunch of individual variables.

3 Likes

I didn’t even think about using a database. Thanks for that suggestion, I’ll look into using an internal one.

Please add this as a Feature

1 Like