Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
635 views
in Technique[技术] by (71.8m points)

hide local listings from google maps api

When using google maps api to display something google has started adding local restaurants/hotels into the map. How can I hide them from appearing. I checked the same locations on sites that use maps (like yelp) and they successfully hide the local hotels/restaurants. I've been looking for layers/overlays but can't figure out how I remove this default behavior.

example These things These things are appearing on my maps. is it possible to hide these bubbles and names?

edit https://developers.google.com/maps/documentation/javascript/releases#36 says that 3.6 introduces business icons on by default. So setting v=3.5 as a parameter will hide the "Business icons".

bounty Is there a way of hiding the business messages without sticking with an older version of the api?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

you can set them invisible by setting the map style properly. See

http://code.google.com/apis/maps/documentation/javascript/styling.html

and

http://code.google.com/intl/pl/apis/maps/documentation/javascript/reference.html#MapTypeStyleFeatureType

sth like that should do the trick (though not tested):

var noPoi = [
{
    featureType: "poi",
    stylers: [
      { visibility: "off" }
    ]   
  }
];

map.setOptions({styles: noPoi});

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...