Note that there are some explanatory texts on larger screens.

plurals
  1. POGoogle maps API(dynamic): plot multiple locations via URL, showing custom markers
    primarykey
    data
    text
    <p>I have successfully implemented code to plot multiple locations on google maps dynamically.</p> <p>Solution: <a href="http://econym.org.uk/gmap/example_plotpoints.htm?q=Hello%20world@53,-2&amp;q=My%20Place@53.5,-2.5" rel="nofollow noreferrer">(link)</a></p> <p>I am trying to create customized labels, like this:</p> <p><a href="http://www.codeproject.com/KB/scripting/Use_of_Google_Map/ex7.JPG" rel="nofollow noreferrer">http://www.codeproject.com/KB/scripting/Use_of_Google_Map/ex7.JPG</a></p> <p>using Tom Morgan's marker:</p> <p><a href="http://abhi2434.googlepages.com/tlabel.2.05.js" rel="nofollow noreferrer">http://abhi2434.googlepages.com/tlabel.2.05.js</a></p> <p>adapted with this code below. (!My goal is to keep the first code I am already using but allow the custom markers from the second code! Every time I try to adapt the second code, it fails....)</p> <p> Google Maps </p> <pre><code>&lt;div id="map" style="width: 550px; height: 450px"&gt;&lt;/div&gt; &lt;script type="text/javascript"&gt; //&lt;![CDATA[ if (GBrowserIsCompatible()) { var openbubble=true; var agent = navigator.userAgent.toLowerCase(); // For IE We need to Do this if ((agent.indexOf("msie") &gt; -1) &amp;&amp; (agent.indexOf("opera") &lt; 1)){ var loader = "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader( src='gmarker.png', sizingMethod='crop');"; icon = '&lt;div style="height:34px; width:20px; ' +loader+ '" &gt;&lt;/div&gt;' } var n=0; function createTLabel(point,html) { var label = new TLabel(); label.id = 'Label '+n; label.anchorLatLng = point; label.anchorPoint = 'bottomCenter'; label.content = html; label.markerOffset = new GSize(-1,-5); map.addTLabel(label); var obj=document.getElementById(label.id); GEvent.addDomListener(obj, "click", function() { //map.openInfoWindowHtml(point, html, {pixelOffset: new GSize(0,-34)} ); }); n++; } var map = new GMap2(document.getElementById("map")); map.addControl(new GLargeMapControl()); map.addControl(new GMapTypeControl()); map.setCenter(new GLatLng(43.907787,-79.359741),8); // Creating the HTML to show markers var hContent = '&lt;div style="padding: 0px 0px 13px 0px; background: url( images/pt_bot_ctr_ora.png) no-repeat bottom center;"&gt; &lt;div style="text-align: center; background-color: #f2c30c; padding: 2px; font-size: 0.75em; font-weight: bold;" onclick="openInfo(\'hInfo\')"&gt;MyInfo &lt;/div&gt;'; hContent+='&lt;div id="hInfo" style="position: absolute; display: none;"&gt;'; hContent+='&lt;div style="width: 81px; background-color: #000; padding: 3px; font-size: 0.75em; color: #fff; text-align: left; border: 1px solid #f2c30c;"&gt; This is my content&lt;/div&gt;'; hContent+='&lt;/div&gt;&lt;/div&gt;'; createTLabel(new GLatLng(43.65654,-79.90138),hContent); } else { alert("Sorry, the Google Maps API is not compatible with this browser"); } function openInfo(d) { var obj = document.getElementById(d); if(openbubble==true) { obj.style.display="block"; openbubble=false; } else { obj.style.display="none"; openbubble=true; } } //]]&gt; &lt;/script&gt; </code></pre> <p></p> <p></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload