miocene Posted June 21, 2009 Share Posted June 21, 2009 I have my developer API key for google maps and have succesfully embedded a google map into my site.All I want now is to place a single simple marker at a coordinate.What is the javascript code to achieve this? Link to comment Share on other sites More sharing options...
Laegnur Posted June 21, 2009 Share Posted June 21, 2009 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 More sharing options...
miocene Posted June 21, 2009 Author Share Posted June 21, 2009 That's great cheers! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.