jquery - google maps custom markers / shadow help needed -
so have google maps directions on website, have managed change icon, although can't seem align original marker shadow (which need removing also, it's point show custom marker off). hope made sense?
the url is: http://www.emuholidaypark.com.au/location.html
as you'll see, there custom marker (not aligned properly) , original shadow (which can't seem rid of?)
the code is:
var gdir, fromaddress, toaddress; function initialize() { if (gbrowseriscompatible()) { //settings var companymarkerimage = "/templates/home/images/mymarker.png"; var companylatlng = new glatlng(-37.056800, 142.329023); var companymarkersize = new gsize(91, 53); //width, height toaddress = "emu holiday park"; var defaultzoomlevel = 13; //end settings //setup elements map = new gmap2(document.getelementbyid("map_canvas")); gdir = new gdirections(map, document.getelementbyid("directions")); //error handler gevent.addlistener(gdir, "error", handleerrors); //set company marker var companymarker = createmarker(companylatlng, companymarkerimage, companymarkersize); //set map center map.setcenter(companylatlng, defaultzoomlevel); map.addoverlay(companymarker); map.addcontrol(new gsmallmapcontrol()); } } function overlaydirections(){ fromaddress = document.getelementbyid("street").value + " " + document.getelementbyid("city").value + " " + document.getelementbyid("state").options[document.getelementbyid("state").selectedindex].value + " " + document.getelementbyid("zip").value; gdir.load("from: " + fromaddress + " to: " + toaddress ); } function createmarker(latlng, imageurl, imagesize) { var marker = new gicon(g_default_icon, imageurl); marker.iconsize = imagesize; return new gmarker(latlng, { icon: marker }); } function handleerrors(){ if (gdir.getstatus().code == g_geo_unknown_address) alert("no corresponding geographic location found 1 of specified addresses. may due fact address relatively new, or may incorrect.\nerror code: " + gdir.getstatus().code); else if (gdir.getstatus().code == g_geo_server_error) alert("a geocoding or directions request not processed, yet exact reason failure not known.\n error code: " + gdir.getstatus().code); else if (gdir.getstatus().code == g_geo_missing_query) alert("the http q parameter either missing or had no value. geocoder requests, means empty address specified input. directions requests, means no query specified in input.\n error code: " + gdir.getstatus().code); else if (gdir.getstatus().code == g_geo_bad_key) alert("the given key either invalid or not match domain given. \n error code: " + gdir.getstatus().code); else if (gdir.getstatus().code == g_geo_bad_request) alert("a directions request not parsed.\n error code: " + gdir.getstatus().code); else alert("an unknown error occurred."); }
function createmarker(latlng, imageurl, imagesize) { var marker = new gicon(g_default_icon, imageurl); marker.iconsize = imagesize; marker.shadow = null; return new gmarker(latlng, { icon: marker }); }
you'll want set iconsize if you're using maker isn't same size standard one.
Comments
Post a Comment