0

Google Maps allows Points of Interests such as Restaurants and stuff to appear clickable and displays their infowindows when clicked which is not what I want. I need only the infowindows attached to my polygons to be clickable and pop open infowindows. I noticed that a way of fixing this would be changing the style of the google maps:

[
 {
  featureType: "poi.business",
  elementType: "labels",
  stylers: [
   { visibility: "off" }
  ]
 }
]

but infowindows still appeared for things like attractions and other random clickable things, how would I be able to disable the infowindows for things like these? Or can you just use featureType: "poi" and featureType: "transit" to set the visibility to off to fix this issue?

mding5692
  • 806
  • 1
  • 10
  • 34
  • https://groups.google.com/forum/#!topic/google-maps-js-api-v3/8aya1No2Bv4 ^I used this above as basis for my questions – mding5692 Jul 10 '15 at 18:53
  • http://stackoverflow.com/questions/7396722/hide-local-listings-from-google-maps-api – mding5692 Jul 10 '15 at 18:59
  • This is likely a duplicate of http://stackoverflow.com/questions/11335299/close-infowindow-for-local-business-marker/11354705 , also this FR was implemented in the JS library now: https://code.google.com/p/gmaps-api-issues/issues/detail?id=3866 – kaskader Jun 09 '16 at 07:56

2 Answers2

1

Try this. in this way all the poi are disabled:

[
   {
          featureType: "poi",
          elementType: "labels",
               stylers: [
                    { visibility: "off" }
                ]
     }
];
ScaisEdge
  • 131,976
  • 10
  • 91
  • 107
1

Ok I made a function that can remove most of the features:

                    /**
                     * Remove all other unnecessary infowindows by rendering Points of Interest invisible
                     * Takes the map, applicable for Google Maps API
                     **/
                     function suppressUnnecessayInfoWindows(mapUsed) {
                        // removes POIs and Transit features off the map
                        var noFeatures = [
                                {
                                    featureType: "poi",
                                    stylers: [
                                      { visibility: "off" }
                                    ]   
                                  },
                                  {
                                    featureType: "transit",
                                    stylers: [
                                      { visibility: "off" }
                                    ]   
                                  }
                                ];
                        // changes the style of the map so that the above is no longer visible
                        mapUsed.setOptions({styles: noFeatures});
                     }
mding5692
  • 806
  • 1
  • 10
  • 34