Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 840661
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T05:39:42+00:00 2026-05-15T05:39:42+00:00

I’ve searched hi and low for info regarding this but to no avail. Basically

  • 0

I’ve searched hi and low for info regarding this but to no avail.

Basically I have a page that is loading a bunch of cateories as checkboxes, for example checkbox 1 is called ‘Exhibitions’ and when clicked on displays all the exhibitions on the map (I am passing the value of the checkbox to the JQuery function which then filters the XML). I have 6 checkboxes all relating to different categories. I have this part all working well but I now need to remove these markers when the checkbox is unticked. I also need it to only remove the markers associated with that category.

Code is below:

MYMAP.placeMarkersTest = function(filename, CatValue) {
$.get(filename, function(xml) {
    $(xml).find("marker").each(function() {

        var eventCat = $(this).find('Category').text();

        if (eventCat == CatValue) {
            var name = $(this).find('name').text();
            var address = $(this).find('name').text();


            var lat = $(this).find('lat').text();
            var lng = $(this).find('lng').text();
            var point = new google.maps.LatLng(parseFloat(lat), parseFloat(lng));

            MYMAP.bounds.extend(point);

            var icon = "/images/mapping/EventsIcon.png";

            var marker = new google.maps.Marker({
                position: point,
                icon: icon,
                map: MYMAP.map
            });

            var infoWindow = new google.maps.InfoWindow();
            var html = '<strong>' + name + '</strong><br />';
            google.maps.event.addListener(marker, 'click', function() {
                infoWindow.setContent(html);
                infoWindow.open(MYMAP.map, marker);
            });
            MYMAP.map.fitBounds(MYMAP.bounds);


        } else {
            //alert("There are no matches");
        }
    });
});
}

Any ideas on how to remove the specific markers would be great, thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T05:39:43+00:00Added an answer on May 15, 2026 at 5:39 am

    When creating your markers you can add the category it belongs to as a property using marker.Set(‘MyProperty’, ‘MyCategory’) then add the markers to a global array. When you are ready to remove the markers you can loop through the marker array and call marker.setMap(null) to remove it from the map.

    var markers = new Array(); 
    
    function setMarkers(map, locations, category) {
            for(var i = 0; i < locations.length; i++) {
                var area = locations[i];
                var latlng = new google.maps.LatLng(area.Location[0], area.Location[1]);
                var marker = new google.maps.Marker({
                    position: latlng,
                    map: map,
                    shadow: markerShadow,
                    icon: markerImage,
                    shape: markerShape,
                    title: area.Name
                });
                marker.set('category', category);
                markers.push(marker);
            }
        }
    
    function clearMarkers(category) {
        for(var i = 0; i < markers.length; i++) {
              if (markers[i].get('category') == category) {
                markers[i].setMap(null);
              }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
This could be a duplicate question, but I have no idea what search terms
That's pretty much it. I'm using Nokogiri to scrape a web page what has
this is what i have right now Drawing an RSS feed into the php,
I have a small JavaScript validation script that validates inputs based on Regex. I
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I know there's a lot of other questions out there that deal with this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.