# How to remove marker on google maps once another marker is placed

**URL:** <https://community.thunkable.com/t/how-to-remove-marker-on-google-maps-once-another-marker-is-placed/1999758>\
**Category:** Maps\
**Created:** [August 15, 2022, 7:05am UTC](https://community.thunkable.com/t/how-to-remove-marker-on-google-maps-once-another-marker-is-placed/1999758 "2022-08-15T07:05:44Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![leviocsmithk](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/leviocsmithk/32/136645_2.png) [@leviocsmithk](https://community.thunkable.com/u/leviocsmithk)\
**Post date:** [September 28, 2022, 2:55am UTC](https://community.thunkable.com/t/how-to-remove-marker-on-google-maps-once-another-marker-is-placed/1999758/21 "2022-09-28T02:55:51Z")

</div>

Ok, I will try that out

Many Thanks Levi

---

<div class="post-metadata">

**Author:** ![leviocsmithk](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/leviocsmithk/32/136645_2.png) [@leviocsmithk](https://community.thunkable.com/u/leviocsmithk)\
**Post date:** [September 28, 2022, 3:32am UTC](https://community.thunkable.com/t/how-to-remove-marker-on-google-maps-once-another-marker-is-placed/1999758/22 "2022-09-28T03:32:43Z")

</div>

That idea almost works except is it still difficult to work out which marker is the most recent from the user’s perspective, is there a way I can make the marker be green for example when it is the most recent, the change to red after a new marker has been placed?

Many Thanks Levi

---

<div class="post-metadata">

**Author:** ![leviocsmithk](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/leviocsmithk/32/136645_2.png) [@leviocsmithk](https://community.thunkable.com/u/leviocsmithk)\
**Post date:** [September 28, 2022, 3:50am UTC](https://community.thunkable.com/t/how-to-remove-marker-on-google-maps-once-another-marker-is-placed/1999758/23 "2022-09-28T03:50:07Z")

</div>

Here is a photo of what it looks like now:

 ![IMG_0379 2.PNG](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/7/c/7c7f5ace9056068f7fd3dbc18d90d339b4848d83.jpeg)

---

<div class="post-metadata">

**Author:** ![leviocsmithk](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/leviocsmithk/32/136645_2.png) [@leviocsmithk](https://community.thunkable.com/u/leviocsmithk)\
**Post date:** [September 28, 2022, 3:50am UTC](https://community.thunkable.com/t/how-to-remove-marker-on-google-maps-once-another-marker-is-placed/1999758/24 "2022-09-28T03:50:25Z")

</div>

See how it looks a bit random.

---

<div class="post-metadata">

**Author:** ![leviocsmithk](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/leviocsmithk/32/136645_2.png) [@leviocsmithk](https://community.thunkable.com/u/leviocsmithk)\
**Post date:** [September 29, 2022, 4:34am UTC](https://community.thunkable.com/t/how-to-remove-marker-on-google-maps-once-another-marker-is-placed/1999758/25 "2022-09-29T04:34:45Z")

</div>

Here is what the code looks like:

 ![Screen Shot 2022-09-29 at 2.34.16 pm](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/3/5/35316d07a6377bfa2ea673e44f4f3cbcd56bb20c.png)

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [September 29, 2022, 4:32pm UTC](https://community.thunkable.com/t/how-to-remove-marker-on-google-maps-once-another-marker-is-placed/1999758/26 "2022-09-29T16:32:04Z")

</div>

In your `count with i` loop, you’re cycling through all of the lat/lon values and adding markers. But the last row in the data source contains the most recent/current location. So in that loop, add an If block that says if i=length of app variable latlist then set pinColor to green (or whatever color)… else set pinColor to black (or whatever color).

---

<div class="post-metadata">

**Author:** ![leviocsmithk](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/leviocsmithk/32/136645_2.png) [@leviocsmithk](https://community.thunkable.com/u/leviocsmithk)\
**Post date:** [September 29, 2022, 10:33pm UTC](https://community.thunkable.com/t/how-to-remove-marker-on-google-maps-once-another-marker-is-placed/1999758/27 "2022-09-29T22:33:42Z")

</div>

Ok thanks for the info, I will try that out today.

Many Thanks Levi

---

<div class="post-metadata">

**Author:** ![leviocsmithk](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/leviocsmithk/32/136645_2.png) [@leviocsmithk](https://community.thunkable.com/u/leviocsmithk)\
**Post date:** [September 30, 2022, 10:16am UTC](https://community.thunkable.com/t/how-to-remove-marker-on-google-maps-once-another-marker-is-placed/1999758/28 "2022-09-30T10:16:22Z")

</div>

So I add what you said here correct?

 ![Screen Shot 2022-09-30 at 8.14.35 pm](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/3/9/3995cab7e11aa01f48379e7f99b564a7b072c373.png)

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [September 30, 2022, 2:59pm UTC](https://community.thunkable.com/t/how-to-remove-marker-on-google-maps-once-another-marker-is-placed/1999758/29 "2022-09-30T14:59:59Z")

</div>

Yes.

---

<div class="post-metadata">

**Author:** ![leviocsmithk](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/leviocsmithk/32/136645_2.png) [@leviocsmithk](https://community.thunkable.com/u/leviocsmithk)\
**Post date:** [October 1, 2022, 12:48am UTC](https://community.thunkable.com/t/how-to-remove-marker-on-google-maps-once-another-marker-is-placed/1999758/30 "2022-10-01T00:48:02Z")

</div>

I have tried what you have said but it does not let me connect the blocks together?

 ![Screen Shot 2022-10-01 at 10.47.29 am](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/d/0d0db86621b00cd568efb7a22ec35eb82f732724.png)

---

<div class="post-metadata">

**Author:** ![leviocsmithk](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/leviocsmithk/32/136645_2.png) [@leviocsmithk](https://community.thunkable.com/u/leviocsmithk)\
**Post date:** [October 1, 2022, 1:03am UTC](https://community.thunkable.com/t/how-to-remove-marker-on-google-maps-once-another-marker-is-placed/1999758/31 "2022-10-01T01:03:42Z")

</div>

What Part of it am I doing wrong?

---

<div class="post-metadata">

**Author:** ![leviocsmithk](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/leviocsmithk/32/136645_2.png) [@leviocsmithk](https://community.thunkable.com/u/leviocsmithk)\
**Post date:** [October 1, 2022, 2:11am UTC](https://community.thunkable.com/t/how-to-remove-marker-on-google-maps-once-another-marker-is-placed/1999758/32 "2022-10-01T02:11:58Z")

</div>

I have tried to do what you have said here, but it does not seem to let me add the colour part.

 ![Screen Shot 2022-10-01 at 12.11.05 pm](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/9/49086263569d8cc39cd2f7a6827d51cab812c6e5.png)

---

<div class="post-metadata">

**Author:** ![leviocsmithk](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/leviocsmithk/32/136645_2.png) [@leviocsmithk](https://community.thunkable.com/u/leviocsmithk)\
**Post date:** [October 1, 2022, 3:56am UTC](https://community.thunkable.com/t/how-to-remove-marker-on-google-maps-once-another-marker-is-placed/1999758/33 "2022-10-01T03:56:53Z")

</div>

Or should I try something like this:

 ![Screen Shot 2022-10-01 at 1.56.02 pm](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/2/8/280918f315ed715ef3e413d9336444e3c3c9e513.png)

I have no idea if that will work.

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [October 1, 2022, 4:34am UTC](https://community.thunkable.com/t/how-to-remove-marker-on-google-maps-once-another-marker-is-placed/1999758/34 "2022-10-01T04:34:34Z")

</div>

You’re on the right track but if you read my post carefully, the If condition I suggested is `i = length of app variable latlist`. In that last screenshot, you have the If condition as `length of i = app variable latlist`. That won’t work.

The point of checking the value of i is that it’s the loop index. So when i is equal to the length of the list that you are looping through, that means you’ve reached the last item in the list.

---

<div class="post-metadata">

**Author:** ![leviocsmithk](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/leviocsmithk/32/136645_2.png) [@leviocsmithk](https://community.thunkable.com/u/leviocsmithk)\
**Post date:** [October 2, 2022, 8:52am UTC](https://community.thunkable.com/t/how-to-remove-marker-on-google-maps-once-another-marker-is-placed/1999758/35 "2022-10-02T08:52:09Z")

</div>

So should I swap them around like this:

 ![Screen Shot 2022-10-02 at 6.45.58 pm](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/7/1/7146051509ca2071ba98fcec01bf4fb1d8c6e7a1.png)

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [October 2, 2022, 4:24pm UTC](https://community.thunkable.com/t/how-to-remove-marker-on-google-maps-once-another-marker-is-placed/1999758/36 "2022-10-02T16:24:55Z")

</div>

Nope, that’s still the same thing. You just switched the sides of the same equation. Here’s what you need:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/f/4/f47ea67c016f07ce4cf449d19aed01518860490b.png)

---

<div class="post-metadata">

**Author:** ![leviocsmithk](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/leviocsmithk/32/136645_2.png) [@leviocsmithk](https://community.thunkable.com/u/leviocsmithk)\
**Post date:** [October 2, 2022, 9:02pm UTC](https://community.thunkable.com/t/how-to-remove-marker-on-google-maps-once-another-marker-is-placed/1999758/37 "2022-10-02T21:02:49Z")

</div>

Oh, Ok, Thanks, I will try that. 🙂

---

<div class="post-metadata">

**Author:** ![leviocsmithk](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/leviocsmithk/32/136645_2.png) [@leviocsmithk](https://community.thunkable.com/u/leviocsmithk)\
**Post date:** [October 3, 2022, 9:18pm UTC](https://community.thunkable.com/t/how-to-remove-marker-on-google-maps-once-another-marker-is-placed/1999758/38 "2022-10-03T21:18:23Z")

</div>

Do I keep both of the blocks to place markers?

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [October 3, 2022, 10:33pm UTC](https://community.thunkable.com/t/how-to-remove-marker-on-google-maps-once-another-marker-is-placed/1999758/39 "2022-10-03T22:33:12Z")

</div>

Yes. Because the `if` condition has two possible values: true or false. So if true, then you’ll create a marker with a green pin; and if false, then you’ll create a marker with a red pin.

---

<div class="post-metadata">

**Author:** ![leviocsmithk](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/leviocsmithk/32/136645_2.png) [@leviocsmithk](https://community.thunkable.com/u/leviocsmithk)\
**Post date:** [October 4, 2022, 6:33am UTC](https://community.thunkable.com/t/how-to-remove-marker-on-google-maps-once-another-marker-is-placed/1999758/40 "2022-10-04T06:33:04Z")

</div>

Cool, thanks also do I need to change anything on the first marker to do with the lat and long, or should I keep them as they are on 0?

![Screen Shot 2022-10-04 at 4.32.58 pm](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/c/8/c8db3240fc2309df892b3272931d21d584112a7c.png)

[Previous page](https://community.thunkable.com/t/how-to-remove-marker-on-google-maps-once-another-marker-is-placed/1999758.md?page=1)

[Next page](https://community.thunkable.com/t/how-to-remove-marker-on-google-maps-once-another-marker-is-placed/1999758.md?page=3)
