27.10.2014 Views

Google Maps API 3

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 6 ■ MARKER ICONS<br />

Figure 6-12. Some of the points for the shape<br />

var shape = {<br />

type: 'poly',<br />

coord: [4,4, 29,4, 29,29, 22,29, 17,35, 16,35, 10,29, 4,29, 4,4]<br />

}<br />

Now you’ve defined the shape. To apply it to the custom marker, you add it using the shape property<br />

of the MarkerImage object:<br />

// Adding a marker to the map<br />

var marker = new google.maps.Marker({<br />

position: new google.maps.LatLng(40.756054, -73.986951),<br />

map: map,<br />

icon: wifi,<br />

shadow: shadow,<br />

shape: shape<br />

});<br />

Looking at the result that this code produces, you now have a map with a complex marker that has<br />

both a shadow and a defined clickable area (Figure 6-13).<br />

Figure 6-13. A complex marker icon with a shadow and a defined clickable area<br />

108

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!