WordPress.org

Support

Support » Plugins and Hacks » WP Google Maps » [Resolved] How to set up a styled map ?

[Resolved] How to set up a styled map ?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author WPGMaps

    @wpgmaps

    Hi Pauloscorps
    Sure thing 🙂

    Open wp-google-maps.php
    on line 722, add a new line and add this:

    var WPGMZA_STYLING = new google.maps.StyledMapType('JSON GOES HERE',{name: "WPGMZA STYLING"});
    this.map.mapTypes.set('WPGMZA STYLING', WPGMZA_STYLING);
    this.map.setMapTypeId('WPGMZA STYLING');

    So the section should look like this:

    this.map = new google.maps.Map(jQuery(selector)[0], myOptions);
     this.bounds = new google.maps.LatLngBounds();
     google.maps.event.addListener(MYMAP.map, 'click', function() {
       infoWindow.close();
     });
    
     var WPGMZA_STYLING = new google.maps.StyledMapType('JSON GOES HERE',{name: "WPGMZA STYLING"});
     this.map.mapTypes.set('WPGMZA STYLING', WPGMZA_STYLING);
     this.map.setMapTypeId('WPGMZA STYLING');
    }

    Does that help?

    Kind regards
    Nick

    Hi,

    Thank you for your answer.
    Unfortunately, I tried your code but it doesn’t seem to work.

    I opened the file “wpGoogleMaps.php” (I don’t have the file wp-google-maps.php in the plugin folder), and found the lines you mentioned.

    Here is the final code :

    var WPGMZA_STYLING = new google.maps.StyledMapType(
                        [{
                            "stylers": [
                              { "gamma": 1.18 },
                              { "hue": "#ff0000" },
                              { "saturation": -38 },
                              { "lightness": -38 }
                            ]
                        }], {name: "WPGMZA STYLING"});
                    this.map.mapTypes.set('WPGMZA STYLING', WPGMZA_STYLING);
                    this.map.setMapTypeId('WPGMZA STYLING');

    I set hue to red to make the result visible, but the map always appears with its default style.

    Could you tell what I did wrong ?

    Plugin Author WPGMaps

    @wpgmaps

    Hi
    That’s perfect.
    The effect will only show up on the front end and not on the back end.
    Please confirm that your map is now styled on the front end?

    The map is not styled in the front end either.
    I fully cleaned my browser’s cache and the result is still the same. Nothing.

    Plugin Author WPGMaps

    @wpgmaps

    Please put a link to the map here

    I can’t put the site here because it’s not in production and htpasswd protected. I send you the access from your website’s “Contact Us” section.

    Problem resolved using the Gold extension.
    Thank’s a lot for the great support and the plugin.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Resolved] How to set up a styled map ?’ is closed to new replies.
Skip to toolbar