title: Google Maps Marker Filtering via category
body: <p>Good day fellow Stackers,</p>
  
  <p>I have a working example of my dilemma <a href="https://jsfiddle.net/ajikanfan/vLjz4pxz/" rel="nofollow noreferrer"><strong>here</strong></a>.</p>
  
  <p>It's an old problem, so I do apologize. I'm struggling because other examples have the map locations stored in a simple array, while mine is stored in a object. I was working off someone else's code from <a href="https://jsfiddle.net/drytwvL8/738/" rel="nofollow noreferrer"><strong>here</strong></a>.</p>
  
  <p>I'm sure my code is a chaotic, but I managed to get pull the relevant values from the keys, however when I apply google maps javascript functions or other methods, they just don't seem to work. Even though it is listening for the markers.</p>
  
  <p>Any help would be much appreciated!</p>
  
  <p>Here is an extract of the code I am struggling with:</p>
  
  <pre><code>document.getElementById('type').addEventListener("change", function() {
    for (var i=0; i&lt;markers.length; i++) {
      marker = gmarkers1[i];
      console.log(markers[i]);
      for (var key in markers[i]) {
        console.log(markers[i].category);
        if (markers[i].category == data || data.length === 0) {
          console.log(data);
          marker.setVisible(false);
        } else {
          console.log(data);
          marker.setVisible(false);
        }
      }
    }
  });
  </code></pre>