<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Google Maps API 3 &#8211; Markers</title>
	<atom:link href="http://www.svennerberg.com/2009/07/google-maps-api-3-markers/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.svennerberg.com/2009/07/google-maps-api-3-markers/</link>
	<description>Web Applications Designed for Humans</description>
	<lastBuildDate>Fri, 03 Feb 2012 20:33:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Antoniu</title>
		<link>http://www.svennerberg.com/2009/07/google-maps-api-3-markers/#comment-1273</link>
		<dc:creator>Antoniu</dc:creator>
		<pubDate>Fri, 03 Feb 2012 01:37:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.svennerberg.com/?p=2115#comment-1273</guid>
		<description>Hi Gabriel,

I am displaying 10 locations on google map using the example with fitbounds.
My search page is retreiving a list on information thorough ajax/jason call and then I hide the search page and display the list and a map with first then rows locations. 
All is ajax and the page itself is not posted back to the server.
It works perfect first time, displays all 10 locations on map but after i go back to search page (without posting back, just hide unhide the differen pages on client) and hit search again the map is not displaying again the 10 locations.
I coudl not find any solution to the issue.

Code is bellow:

 var arr =[&#039;red_MarkerA.png&#039;, &#039;red_MarkerB.png&#039;, &#039;red_MarkerC.png&#039;, &#039;red_MarkerD.png&#039;, &#039;red_MarkerE.png&#039;, &#039;red_MarkerF.png&#039;, &#039;red_MarkerG.png&#039;, &#039;red_MarkerH.png&#039;, &#039;red_MarkerI.png&#039;, &#039;red_MarkerJ.png&#039;];
    

    function initialize(points) {

        var mapObj = null;        

        var myOptions = {
            zoom: 11,
            center: new google.maps.LatLng(points[0].Latitude, points[0].Longitude),
            mapTypeControl: true,
            mapTypeControlOptions: { style: google.maps.MapTypeControlStyle.DROPDOWN_MENU },
            navigationControl: true,
            mapTypeId: google.maps.MapTypeId.ROADMAP
        }

        if (&quot;ProviderSearch&quot; == GetSearchType()) {
            mapObj = new google.maps.Map(document.getElementById(&quot;map_canvas&quot;),
                                myOptions);
        }
        else if (&quot;HospitalSearch&quot; == GetSearchType()) {
            mapObj = new google.maps.Map(document.getElementById(&quot;mapHospital&quot;),
                                myOptions);
        }

//        google.maps.event.addListener(map, &#039;click&#039;, function() {
//            infowindow.close();
//        });

        //alert(points.length);
        if (points.length &gt; 1) {
            // Add markers to the map
            // Set up three markers with info windows
            var currentAddress = points[0].Address;
            var point = new google.maps.LatLng(points[0].Latitude, points[0].Longitude);
//            var marker = createMarker(point,
//                &#039;&#039; + currentAddress + &#039; &lt;a href=&quot;&quot; rel=&quot;nofollow&quot;&gt;Link&lt;/a&gt; Map &#039;,
            //                &#039;../../content/images/&#039; + arr[0]);
            

            var marker = new google.maps.Marker({
                position: point,
                map: mapObj,
                icon: &#039;../../content/images/&#039; + arr[0]

                //zIndex: Math.round(latlng.lat() * -100000) &lt;&lt; 3
            });
           
            var j = 1;
            //alert(&#039;after arr&#039;);
            var bounds = new google.maps.LatLngBounds();
            bounds.extend(point);
            //alert(&#039;before loop&#039;);
            // Add markers to the map  with info windows
            for (var i = 0; i &lt; 10 &amp;&amp; i &lt; points.length; i++) {

                var lo = points[i].Longitude;
                var la = points[i].Latitude;
                //alert(points[i].Longitude + &quot; &quot; + points[i].Latitude + &quot; &quot; + points[i].FullName);
                var path = &#039;../../content/images/&#039;;

                if (currentAddress != points[i].Address) {//alert(&#039;i &#039; + i + &#039; j &#039; + j);

                    var point = new google.maps.LatLng(la, lo);
                    bounds.extend(point);
                    
                    var marker = new google.maps.Marker({
                        position: point,
                        map: mapObj,
                        icon: &#039;../../content/images/&#039; + arr[j]

                        //zIndex: Math.round(latlng.lat() * -100000) &lt;&lt; 3
                    });

                   

                    j++;
                }          
                currentAddress = points[i].Address;
            }
            mapObj.fitBounds(bounds);
            bounds = null;
            
        }
        
    }
</description>
		<content:encoded><![CDATA[<p>Hi Gabriel,</p>
<p>I am displaying 10 locations on google map using the example with fitbounds.<br />
My search page is retreiving a list on information thorough ajax/jason call and then I hide the search page and display the list and a map with first then rows locations.<br />
All is ajax and the page itself is not posted back to the server.<br />
It works perfect first time, displays all 10 locations on map but after i go back to search page (without posting back, just hide unhide the differen pages on client) and hit search again the map is not displaying again the 10 locations.<br />
I coudl not find any solution to the issue.</p>
<p>Code is bellow:</p>
<p> var arr =['red_MarkerA.png', 'red_MarkerB.png', 'red_MarkerC.png', 'red_MarkerD.png', 'red_MarkerE.png', 'red_MarkerF.png', 'red_MarkerG.png', 'red_MarkerH.png', 'red_MarkerI.png', 'red_MarkerJ.png'];</p>
<p>    function initialize(points) {</p>
<p>        var mapObj = null;        </p>
<p>        var myOptions = {<br />
            zoom: 11,<br />
            center: new google.maps.LatLng(points[0].Latitude, points[0].Longitude),<br />
            mapTypeControl: true,<br />
            mapTypeControlOptions: { style: google.maps.MapTypeControlStyle.DROPDOWN_MENU },<br />
            navigationControl: true,<br />
            mapTypeId: google.maps.MapTypeId.ROADMAP<br />
        }</p>
<p>        if (&#8220;ProviderSearch&#8221; == GetSearchType()) {<br />
            mapObj = new google.maps.Map(document.getElementById(&#8220;map_canvas&#8221;),<br />
                                myOptions);<br />
        }<br />
        else if (&#8220;HospitalSearch&#8221; == GetSearchType()) {<br />
            mapObj = new google.maps.Map(document.getElementById(&#8220;mapHospital&#8221;),<br />
                                myOptions);<br />
        }</p>
<p>//        google.maps.event.addListener(map, &#8216;click&#8217;, function() {<br />
//            infowindow.close();<br />
//        });</p>
<p>        //alert(points.length);<br />
        if (points.length &gt; 1) {<br />
            // Add markers to the map<br />
            // Set up three markers with info windows<br />
            var currentAddress = points[0].Address;<br />
            var point = new google.maps.LatLng(points[0].Latitude, points[0].Longitude);<br />
//            var marker = createMarker(point,<br />
//                &#8221; + currentAddress + &#8216; <a href="" rel="nofollow">Link</a> Map &#8216;,<br />
            //                &#8216;../../content/images/&#8217; + arr[0]);</p>
<p>            var marker = new google.maps.Marker({<br />
                position: point,<br />
                map: mapObj,<br />
                icon: &#8216;../../content/images/&#8217; + arr[0]</p>
<p>                //zIndex: Math.round(latlng.lat() * -100000) &lt;&lt; 3<br />
            });</p>
<p>            var j = 1;<br />
            //alert(&#039;after arr&#039;);<br />
            var bounds = new google.maps.LatLngBounds();<br />
            bounds.extend(point);<br />
            //alert(&#039;before loop&#039;);<br />
            // Add markers to the map  with info windows<br />
            for (var i = 0; i &lt; 10 &amp;&amp; i &lt; points.length; i++) {</p>
<p>                var lo = points[i].Longitude;<br />
                var la = points[i].Latitude;<br />
                //alert(points[i].Longitude + &quot; &quot; + points[i].Latitude + &quot; &quot; + points[i].FullName);<br />
                var path = &#039;../../content/images/&#039;;</p>
<p>                if (currentAddress != points[i].Address) {//alert(&#039;i &#039; + i + &#039; j &#039; + j);</p>
<p>                    var point = new google.maps.LatLng(la, lo);<br />
                    bounds.extend(point);</p>
<p>                    var marker = new google.maps.Marker({<br />
                        position: point,<br />
                        map: mapObj,<br />
                        icon: &#039;../../content/images/&#039; + arr[j]</p>
<p>                        //zIndex: Math.round(latlng.lat() * -100000) &lt;&lt; 3<br />
                    });</p>
<p>                    j++;<br />
                }<br />
                currentAddress = points[i].Address;<br />
            }<br />
            mapObj.fitBounds(bounds);<br />
            bounds = null;</p>
<p>        }</p>
<p>    }</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mandy</title>
		<link>http://www.svennerberg.com/2009/07/google-maps-api-3-markers/#comment-1249</link>
		<dc:creator>Mandy</dc:creator>
		<pubDate>Wed, 28 Dec 2011 23:14:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.svennerberg.com/?p=2115#comment-1249</guid>
		<description>Hi Gabriel, I have a map with several markers and the centre is based on the position of all markers. In some maps, the centre points to a place with no markers. How do I set the map to show the nearest marker when the center of the map has no marker.
Any help is much appreciated.</description>
		<content:encoded><![CDATA[<p>Hi Gabriel, I have a map with several markers and the centre is based on the position of all markers. In some maps, the centre points to a place with no markers. How do I set the map to show the nearest marker when the center of the map has no marker.<br />
Any help is much appreciated.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chamil512</title>
		<link>http://www.svennerberg.com/2009/07/google-maps-api-3-markers/#comment-1241</link>
		<dc:creator>Chamil512</dc:creator>
		<pubDate>Mon, 19 Dec 2011 07:46:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.svennerberg.com/?p=2115#comment-1241</guid>
		<description>You are great!!! Thanks for your script... It was very useful to me... </description>
		<content:encoded><![CDATA[<p>You are great!!! Thanks for your script&#8230; It was very useful to me&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: le</title>
		<link>http://www.svennerberg.com/2009/07/google-maps-api-3-markers/#comment-1218</link>
		<dc:creator>le</dc:creator>
		<pubDate>Tue, 06 Dec 2011 09:50:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.svennerberg.com/?p=2115#comment-1218</guid>
		<description>how can i differentiate between markers added using overlay</description>
		<content:encoded><![CDATA[<p>how can i differentiate between markers added using overlay</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://www.svennerberg.com/2009/07/google-maps-api-3-markers/#comment-1203</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Sat, 05 Nov 2011 01:17:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.svennerberg.com/?p=2115#comment-1203</guid>
		<description>Hi Gabriel! Thanks a lot for helping me!

Could you say where in my html (below) I must insert the code?





  #map_canvas { width: 400px; height: 300px; }



var map;
var layer;
var tableid = 1882479;
function initialize() {
  map = new google.maps.Map(document.getElementById(&#039;map_canvas&#039;), {
    center: new google.maps.LatLng(-30.066716983885626, -51.233367919921875),
    zoom: 10,
    mapTypeId: google.maps.MapTypeId.ROADMAP
  });
  layer = new google.maps.FusionTablesLayer(tableid);
  layer.setQuery(&quot;SELECT &#039;ENDERECO_GOOGLE&#039; FROM &quot; + tableid);
  layer.setMap(map);
}





</description>
		<content:encoded><![CDATA[<p>Hi Gabriel! Thanks a lot for helping me!</p>
<p>Could you say where in my html (below) I must insert the code?</p>
<p>  #map_canvas { width: 400px; height: 300px; }</p>
<p>var map;<br />
var layer;<br />
var tableid = 1882479;<br />
function initialize() {<br />
  map = new google.maps.Map(document.getElementById(&#8216;map_canvas&#8217;), {<br />
    center: new google.maps.LatLng(-30.066716983885626, -51.233367919921875),<br />
    zoom: 10,<br />
    mapTypeId: google.maps.MapTypeId.ROADMAP<br />
  });<br />
  layer = new google.maps.FusionTablesLayer(tableid);<br />
  layer.setQuery(&#8220;SELECT &#8216;ENDERECO_GOOGLE&#8217; FROM &#8221; + tableid);<br />
  layer.setMap(map);<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gabriel Svennerberg</title>
		<link>http://www.svennerberg.com/2009/07/google-maps-api-3-markers/#comment-1201</link>
		<dc:creator>Gabriel Svennerberg</dc:creator>
		<pubDate>Fri, 04 Nov 2011 07:47:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.svennerberg.com/?p=2115#comment-1201</guid>
		<description>Hi Daniel. 

Absolutely. It&#039;s entirely possible. You need to attach a mouseover event to the marker and change its icon when it triggers. Then of course you probably want to change it back on the mouseout event. The code to do that looks something like this:

&lt;code&gt;
google.maps.event.addListener(yourMarker, &#039;mouseover&#039;, function(e) {
  yourMarker.setIcon(&#039;url/to/bigger/icon/&#039;);
});
google.maps.event.addListener(yourMarker, &#039;mouseout&#039;, function(e) {
  yourMarker.setIcon(&#039;url/to/normal/icon/&#039;);
});
&lt;/code&gt;
Cheers,
Gabriel</description>
		<content:encoded><![CDATA[<p>Hi Daniel. </p>
<p>Absolutely. It&#8217;s entirely possible. You need to attach a mouseover event to the marker and change its icon when it triggers. Then of course you probably want to change it back on the mouseout event. The code to do that looks something like this:</p>
<p><code><br />
google.maps.event.addListener(yourMarker, 'mouseover', function(e) {<br />
  yourMarker.setIcon('url/to/bigger/icon/');<br />
});<br />
google.maps.event.addListener(yourMarker, 'mouseout', function(e) {<br />
  yourMarker.setIcon('url/to/normal/icon/');<br />
});<br />
</code><br />
Cheers,<br />
Gabriel</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://www.svennerberg.com/2009/07/google-maps-api-3-markers/#comment-1200</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Fri, 04 Nov 2011 02:13:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.svennerberg.com/?p=2115#comment-1200</guid>
		<description>Hi Gabriel! Nice article!

I would like to ask to you if there&#039;s a way to make the markers a little bigger when the mouse pointer hovers on it.

Thanks,
Daniel</description>
		<content:encoded><![CDATA[<p>Hi Gabriel! Nice article!</p>
<p>I would like to ask to you if there&#8217;s a way to make the markers a little bigger when the mouse pointer hovers on it.</p>
<p>Thanks,<br />
Daniel</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Using Google Map &#8211; Javascript Resources</title>
		<link>http://www.svennerberg.com/2009/07/google-maps-api-3-markers/#comment-1127</link>
		<dc:creator>Using Google Map &#8211; Javascript Resources</dc:creator>
		<pubDate>Fri, 28 Oct 2011 17:02:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.svennerberg.com/?p=2115#comment-1127</guid>
		<description>[...] know about the Google API 3.Google Maps API3 &#8211; The basicsGoogle Maps API3 &#8211; Map SettingsGoogle Maps API3 &#8211; MarkersGoogle Maps API3 &#8211; InfoWindowsGoogle Maps API3 &#8211; Mobile devicesOther useful [...]</description>
		<content:encoded><![CDATA[<p>[...] know about the Google API 3.Google Maps API3 &#8211; The basicsGoogle Maps API3 &#8211; Map SettingsGoogle Maps API3 &#8211; MarkersGoogle Maps API3 &#8211; InfoWindowsGoogle Maps API3 &#8211; Mobile devicesOther useful [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jim Buckley BArrett</title>
		<link>http://www.svennerberg.com/2009/07/google-maps-api-3-markers/#comment-1011</link>
		<dc:creator>Jim Buckley BArrett</dc:creator>
		<pubDate>Thu, 13 Oct 2011 14:25:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.svennerberg.com/?p=2115#comment-1011</guid>
		<description>I found this link today, http://google-maps-utility-library-v3.googlecode.com/svn/trunk/maplabel/examples/maplabel.html</description>
		<content:encoded><![CDATA[<p>I found this link today, <a href="http://google-maps-utility-library-v3.googlecode.com/svn/trunk/maplabel/examples/maplabel.html" rel="nofollow">http://google-maps-utility-library-v3.googlecode.com/svn/trunk/maplabel/examples/maplabel.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://www.svennerberg.com/2009/07/google-maps-api-3-markers/#comment-1006</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Wed, 12 Oct 2011 00:48:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.svennerberg.com/?p=2115#comment-1006</guid>
		<description>Hi, Gabriel.  Just found this site after I sent you an email.  Got your book and learned much from it.  I am trying to create a map similar to the example in Chapter 6, p. 126 Listing 6-5, &#039;Faking an Axaj Call&#039;.  What I need to do is have the data fetched from a mySQL database rather than a web service.  I&#039;ve been searching the web and trying to use Ajax and JSON to do it, but have not been successful.  If I could see the example of listing 6-5 where it fetches the data from a mySQL database or an array from the mySQL database, I think I could make it work.  Thanks in advance.  Gary.      </description>
		<content:encoded><![CDATA[<p>Hi, Gabriel.  Just found this site after I sent you an email.  Got your book and learned much from it.  I am trying to create a map similar to the example in Chapter 6, p. 126 Listing 6-5, &#8216;Faking an Axaj Call&#8217;.  What I need to do is have the data fetched from a mySQL database rather than a web service.  I&#8217;ve been searching the web and trying to use Ajax and JSON to do it, but have not been successful.  If I could see the example of listing 6-5 where it fetches the data from a mySQL database or an array from the mySQL database, I think I could make it work.  Thanks in advance.  Gary.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

