tags:

views:

21

answers:

2

Is there an easy way to change the marker when embeding a googlemap with Jquery/javascript?

EDIT bonus Question Is there a way to use an address instead of LatLng?

+1  A: 

This example should help you: http://code.google.com/apis/maps/documentation/javascript/v2/examples/icon-simple.html .

Short description: Create an Icon object and when adding markers set that object as the icon property.

Alin Purcaru
+2  A: 

Google Maps API V3 is now the official version.

http://code.google.com/apis/maps/documentation/javascript/overlays.html#Icons

When you declare the markers use the "icon" property to set an image.

From the documentation:

 var image = 'beachflag.png';
  var myLatLng = new google.maps.LatLng(-33.890542, 151.274856);
  var beachMarker = new google.maps.Marker({
      position: myLatLng,
      map: map,
      icon: image
  });

You can also use the charts API to generate marker images.

E.g. http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=A|FF0000|000000 for a red pin

http://groups.google.com/group/google-chart-api/web/chart-types-for-map-pins?pli=1

Rob Stevenson-Leggett
+1 Go for V3. It's cleaner.
Alin Purcaru