0
votes

How can I filtering gmap markers from Json file?

$(function() { 

                demo.add(function() {
                    $('#map_canvas').gmap({'disableDefaultUI':false, 'callback': function() {

                        var self = this;
                        $.getJSON('demo.asp', function (data) {
                            $.each( data.markers, function(i, marker) {
                                self.addMarker({ 'position': new google.maps.LatLng(marker.latitude, marker.longitude), 'bounds':true } ).click(function() {
                                    self.openInfoWindow({ 'content': marker.content }, this);
                                });
                            });
                        });
                    }}); 
                }).load();
            });
1

1 Answers

0
votes
$(function() { 

                demo.add(function() {
                    $('#map_canvas').gmap({'disableDefaultUI':false, 'callback': function() {

                        var self = this;
                        $.getJSON('demo.asp', function (data) {
                            $.each( data.markers, function(i, marker) {
                            if(marker!="filtered data"){

                                self.addMarker({ 'position': new google.maps.LatLng(marker.latitude, marker.longitude), 'bounds':true } ).click(function() {
                                    self.openInfoWindow({ 'content': marker.content }, this);
                             }
                                });
                            });
                        });
                    }}); 
                }).load();
            });

You can filter it there, or filter it on the logic that gets the json data.