This is looking very promising. The one thing I haven't been able to do yet is to apply the Gmap saturation style values to the map. The Gmap style spec is very simple, just saturation: -100".

As I expected, putting this in the Map styles field doesn't do anything. I've tried putting it in the Map options field but haven't had any luck yet. {"mapTypeId":"roadmap", "zoom":2} works fine, so I've tried extending this along the lines of {"mapTypeId":"roadmap", "zoom":2, StyledMapType(styles:Array.<stylers>, saturation:-100)} - but I'm really just guessing here, so either it does nothing or gives me a "Syntax error in map options" error.

I'd be grateful for any suggestions - am I just putting quotes in the wrong place, or am I trying to make it do something it won't? I should point out that I'm not a developer and arrays tend to make my brain go into an infinite loop...

Comments

rdeboer’s picture

Yeah.. the MapTypeStyle object is rather complex....

This works for me (note the keywords "styles" and "stylers"):

 {"mapTypeId":"roadmap", "zoom":14, "styles":[{"stylers": [{"saturation":-100}]}] }

or add a grey/green hue to the roads only:

 {"mapTypeId":"roadmap", "zoom":10, "styles":[{"featureType":"road", "stylers": [{"saturation":-80}] }] }

To try out more styles and to generate the JSON-syntax used above, see http://gmaps-samples-v3.googlecode.com/svn/trunk/styledmaps/wizard/index.... Use the UI on the left to create your effect, then hit the "Show JSON" button in lower right to copy and paste the JSON.

And while we're at it, here's an example of putting the controls in a different position (right-hand side):

 {"mapTypeId":"roadmap", "zoom":14, "mapTypeControlOptions":{"position":8} }

Good luck!

rdeboer’s picture

Assigned: Unassigned » rdeboer
Status: Active » Fixed

I've updated the help text and also increased the max.allowed length of the map options string in the latest 7.x-1.x-dev snapshot (13 March 2013).

adam_b’s picture

My hero! The styling works perfectly - and now that you've set out the code, I can see how it works. Many thanks.

rdeboer’s picture

Version: 7.x-1.9 » 7.x-1.19
Status: Fixed » Closed (fixed)

Excellent. Closing. The additional example I've added to the configuration panel (see #2) should remind you, me and others how to do it next time.

adam_b’s picture

Status: Closed (fixed) » Needs work

Afraid you didn't "increase the max.allowed length of the map options string" in the new release version - you increased the size to 127, but the length is still limited to 128 chars which means the available options are very limited (at least once you start using styles arrays - those brackets take a lot of characters).

adam_b’s picture

Status: Needs work » Closed (fixed)

Apologies, ignore my previous comment - I think I'd uploaded the wrong copy of the module.

adam_b’s picture

Issue summary: View changes

added caveat in last line