Jump to content

Adding A Simple Marker To A Google Map


miocene
 Share

Recommended Posts

HiI have this code on mi own wesite. Sorry for my bad english...

function initialize() {  if (GBrowserIsCompatible()) {	var map = new GMap2(document.getElementById("map_canvas")); //Change this to yor map content div id	map.setMapType(G_HYBRID_MAP);	map.setCenter(new GLatLng(43.399739,-8.16524), 14); //Change this to your Latitude/Longitude	map.addControl(new GSmallZoomControl3D());	var arelaIcon = new GIcon(G_DEFAULT_ICON);	arelaIcon.shadow = "img/shadow.png";  //Change this to your marker image	arelaIcon.iconSize = new GSize(20, 34);	arelaIcon.shadowSize = new GSize(37, 34);	arelaIcon.iconAnchor = new GPoint(9, 34);	arelaIcon.infoWindowAnchor = new GPoint(9, 2);	arelaIcon.image = "img/marker.png";  // And this to your marker's shadow image	markerOptions = { icon:arelaIcon };	var latlng = new GLatLng(43.400152,-8.165503);  // and finaly change this to your Lattitude/Longitud marker position	var marker = new GMarker(latlng, markerOptions);	GEvent.addListener(marker, "click", function() {  // This is to add a message to the marker	  marker.openInfoWindowHtml("Message");  	});	map.addOverlay(marker);  }}

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...