Topic: Remove markers

Hello there,

I can load a map and  I can search places by using FindPlacesExample.cs and put my marker on that place.
I do not want the other markers which are predefined on a map.
I tried OnlineMaps.instance.RemoveAllMarkers(); but that does not work is there any way i can remove those predefined markers?

Re: Remove markers

Hello.

I wrote a simple script to test RemoveAllMarkers.
Everything works well.

Script:

using UnityEngine;
using Random = System.Random;

public class SpawnAndRemoveMarkers:MonoBehaviour
{
    private void OnGUI()
    {
        if (GUILayout.Button("Spawn"))
        {
            double tlx, tly, brx, bry;
            OnlineMaps.instance.GetCorners(out tlx, out tly, out brx, out bry);
            Random rnd = new Random();
            for (int i = 0; i < 20; i++)
            {
                double lng = rnd.NextDouble() * (brx - tlx) + tlx;
                double lat = rnd.NextDouble() * (tly - bry) + bry;
                OnlineMaps.instance.AddMarker(lng, lat, i.ToString());
            }
        }
        if (GUILayout.Button("Remove all markers"))
        {
            OnlineMaps.instance.RemoveAllMarkers();
            OnlineMaps.instance.Redraw();
        }
    }
}

Please send your script where you create and delete the markers.
I will check it.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: Remove markers

Hello Alex,

Thank you for a reply.
I attached your script in a demo scene and when I click on remove markers button the markers were removed which I added not the one which is provided by google is there any way to remove those markers?

I Attached one screen shot in that you can see orange markers which are predefined not created by me. I want to remove those markers.

Regards,
Ankit

Post's attachments

Attachment icon map.png 823.8 kb, 252 downloads since 2017-04-17 

Re: Remove markers

This is not the markers. This is a POI on Google Maps.
You can remove this by creating your own style using snazzymaps:

{
    "featureType": "poi",
    "elementType": "all",
    "stylers": [
        {
            "visibility": "off"
        }
    ]
},

A step-by-step instruction on how to use snazzymaps in the documentation (section Styled Google Maps).

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.