Google map style - changing colours

My Google map here has the following styles applied:

<div class="small-map" style="width:100%;height:163px;background:url(http://maps.google.com/maps/api/staticmap?center=<%=server.URLEncode(""&rsAdvert("ContactPostcode"))%>&zoom=13&size=348x250&markers=color:red%7Clabel:A%7C<%=server.URLEncode(""&rsAdvert("ContactPostcode"))%>&sensor=false&maptype=roadmap&visual_refresh=true&style=feature:road|element:labels|weight:0.3|color:0x050608&style=feature:poi|element:labels|weight:0.4|color:0x1b1a1b&style=feature:poi|color:0xffffff) center no-repeat;">

Open in new window


I'd like the map to have these options as specified in the google documentation:

var styleArray = [
  {
    featureType: "all",
    stylers: [
      { saturation: -80 }
    ]
  },{
    featureType: "road.arterial",
    elementType: "geometry",
    stylers: [
      { hue: "#00ffee" },
      { saturation: 50 }
    ]
  },{
    featureType: "poi.business",
    elementType: "labels",
    stylers: [
      { visibility: "off" }
    ]
  }
];

Open in new window


Updated code which still doesn't work:

<div class="small-map" style="width:100%;height:163px;background:url(http://maps.google.com/maps/api/staticmap?center=<%=server.URLEncode(""&rsAdvert("ContactPostcode"))%>&zoom=13&size=348x250&markers=color:red%7Clabel:A%7C<%=server.URLEncode(""&rsAdvert("ContactPostcode"))%>&sensor=false&maptype=roadmap&visual_refresh=true&style=feature:road|element:labels|weight:0.3|color:0x050608&style=feature:poi|element:labels|weight:0.4|color:0x1b1a1b&style=feature:poi|color:0xffffff) center no-repeat;"></div></a>

<script type="text/javascript">
function initialize() {

  // Create an array of styles.
  var styles = [
    {
      stylers: [
        { hue: "#00ffe6" },
        { saturation: -20 }
      ]
    },{
      featureType: "road",
      elementType: "geometry",
      stylers: [
        { lightness: 100 },
        { visibility: "simplified" }
      ]
    },{
      featureType: "road",
      elementType: "labels",
      stylers: [
        { visibility: "off" }
      ]
    }
  ];

  // Create a new StyledMapType object, passing it the array of styles,
  // as well as the name to be displayed on the map type control.
  var styledMap = new google.maps.StyledMapType(styles,
    {name: "Styled Map"});

  // Create a map object, and include the MapTypeId to add
  // to the map type control.
  var mapOptions = {
    zoom: 14,
    center: new google.maps.LatLng(55.6468, 37.581),
    mapTypeControlOptions: {
      mapTypeIds: [google.maps.MapTypeId.ROADMAP, 'map_style']
    }
  };
  var map = new google.maps.Map(document.getElementById('map-canvas'),
    mapOptions);

  //Associate the styled map with the MapTypeId and set it to display.
  map.mapTypes.set('map_style', styledMap);
  map.setMapTypeId('map_style');
}
</script>

Open in new window

UName10Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Tom BeckCommented:
You are missing the id in the div that holds the map.

<div id="map-canvas" class="small-map"
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Tom BeckCommented:
...And of course, you need to call the initialize function somewhere, like:

<script type="text/javascript">
initialize();
function initialize() {

    ....

}
</script>
Styled map screen shop
0
UName10Author Commented:
I'll check it out...thanks for the reply
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.