Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

put my own image as marker instead of pin mark

i want to put my marker pin for this code:

  var map = new GMap2(document.getElementById("map-canvas"));
  map.addControl(new GLargeMapControl());
  map.addControl(new GMapTypeControl());
  map.setCenter(new GLatLng(<?=$lat;?>,<?=$lng;?>), 6);

  var point = new GLatLng(<?=$lat;?>,<?=$lng;?>);
  var marker = createMarker(point,'Welcome:<b></b><br>Second Info Window with an image<br><img src="http://localhost/gps/user_photo/" width=80 height=80>')
  map.addOverlay(marker);

  function createMarker(point,html) {
        var marker = new GMarker(point);
        GEvent.addListener(marker, "click", function() {
          marker.openInfoWindowHtml(html);
        });
        return marker;
      }

how can i do that?????

like image 413
keyur Avatar asked May 16 '11 15:05

keyur


1 Answers

The Google Maps V3 API (Make sure you use only that - you seem to use the V2 API!) has a good documentation - make sure you bookmark this, you'll need it.

There are lots of JavaScript samples. Here is an example for building a custom marker.

Also check out the Demo Gallery for advanced applications.

like image 89
Pekka Avatar answered Oct 25 '22 02:10

Pekka