6

When using Google Map API v3 and using the styled map type I can't manage to hide the floor plans that appear when zoomed in. There are a number of "MapTypeStyleFeatureType" options, none of which help to hide the floor plans.

https://developers.google.com/maps/documentation/javascript/reference#MapTypeStyleFeatureType

The API v3 documentation doesn't seem to include anything about the floor plans. Just to be clear, this is an example of a floor plan:

http://maps.googleapis.com/maps/api/staticmap?center=51.496643,-0.172192&zoom=18&format=png&sensor=false&size=640x480&maptype=roadmap&style=feature:administrative|visibility:off

Any help or pointers would be appreciated.

Thanks, Jon.

  • Hi I actually would like this scenario, is there a way to achieve this? Can you share a demo or code for this scenario. Thanks – pal4life Jun 30 '14 at 21:49

2 Answers2

3

ok after a bit more experimentation, here's what I settled with.... set all colours to grey (or whatever colour you want the floor plans to be) in the first style, then re-colour everything you want in the following styles. This results in the floor plans appearing as a single block of colour.

var styles = [
        {
            featureType: "all",
            stylers: [
                { color: "#505050" }
            ]
        },
        {
            featureType: "road",
            elementType: "geometry",
            stylers: [
                { visibility: "simplified" },
                { color: '#505050' }
            ]
        },
        {
            featureType: "all",
            elementType: "labels",
            stylers: [
                { visibility: "off" }
            ]
        },
        {
            featureType: "administrative",
            stylers: [
                { visibility: "off" }
            ]
        },
        {
            featureType: "transit",
            stylers: [
                { visibility: "off" }
            ]
        },
        {
            featureType: "poi",
            stylers: [
                { visibility: "off" }
            ]
        },
        {
            featureType: "landscape",
            stylers: [
                { color: '#FF0000' }
            ]
        },
        {
            featureType: "landscape.man_made",
            stylers: [
                { color: '#393939' }
            ]
        },
        {
            featureType: "landscape.natural",
            stylers: [
                { color: '#393939' }
            ]
        },
        {
            featureType: "water",
            stylers: [
                { color: '#252525' }
            ]
        }
    ];
1

It seems like the "All" option is the only thing that will turn off the labels:

http://maps.googleapis.com/maps/api/staticmap?center=51.496643,-0.172192&zoom=18&format=png&sensor=false&size=640x480&maptype=roadmap&style=feature:all|element:labels|visibility:off

Although poi.attraction does seem to turn off the name of the museum, just not the floorplan

http://maps.googleapis.com/maps/api/staticmap?center=51.496643,-0.172192&zoom=18&format=png&sensor=false&size=640x480&maptype=roadmap&style=feature:poi.attraction|element:labels|visibility:off

javram
  • 2,635
  • 1
  • 13
  • 18