Advertisement

03.29.2008 at 02:29PM PDT, ID: 23279938
[x]
Attachment Details

Multiple markers and info windows with Google Maps

Asked by lepirtle in Cold Fusion Markup Language, JavaScript

Tags:

I am trying to display multiple markers and associated info windows using Coldfusion and Google Maps. Using a test data base with 2 records and a query which restricts the number of records to only 1, my CF page displays properly: 1 marker with an associated info window. However, if I use the same test data base without restricting the number of records, then the CF page does not display the map at all (though the black border of the map object is displayed) Can anyone tell me where I am going wrong? A sample of my code (with the query not restricting the number of records)  is attached. Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
<cfquery name="qtest" datasource="abpdb">
SELECT * from tblMain
<!--- WHERE key =4 --->
</cfquery>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>test3.cfm</title>
    <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=xxx"
      type="text/javascript"></script>
    <script type="text/javascript">
 
    //<![CDATA[
 
    function load() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map"));
        map.setCenter(new GLatLng(35.59499, -82.55198), 12);
		map.addControl(new GSmallMapControl());
		map.addControl(new GMapTypeControl(), new GControlPosition(G_ANCHOR_TOP_RIGHT), new GSize(250, 5));
		map.enableScrollWheelZoom();
		map.enableContinuousZoom();
		<cfoutput query="qtest">
		var point#key# = new GLatLng(#lat#,#long#);
		var marker#key# = new GMarker(point#key#,name);
		var infowindow1html#key# = "<b>#reporter# reported on #LSDateFormat(reporteddatetime, 'yyyy-mm-dd')#:</b><br />#initialdesc#";
				map.addOverlay(marker#key#);
		GEvent.addListener(marker#key#,"click",function(){
			marker#key#.openInfoWindowHtml(infowindow1html#key#);
		</cfoutput>
			});
      }
    }
    //]]>
    </script>
  </head>
  <body style="font-family:Arial, Helvetica, sans-serif; font-size:12px" onload="load()" onunload="GUnload()">
  
    <noscript><b>JavaScript must be enabled in order for you to use Google Maps.</b> 
      However, it seems JavaScript is either disabled or not supported by your browser. 
      To view Google Maps, enable JavaScript by changing your browser options, and then 
      try again.
    </noscript>
 
    <div id="map" style="width: 600px; height: 350px; border-width:1px; border-style:solid; border-color:black; margin-left:auto; margin-right:auto"></div>
<cfoutput query="qtest">
<p>#reporteddatetime#,<br />
#reporter#<br />
#lat#,#long#<br />
#initialdesc#<br />
Primary key number: #key#<br />
Current row number: #currentrow#.</p>
</cfoutput> 
</body>
</html>
[+][-]03.30.2008 at 05:01PM PDT, ID: 21242448

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.30.2008 at 06:16PM PDT, ID: 21242647

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.30.2008 at 07:34PM PDT, ID: 21242845

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Cold Fusion Markup Language, JavaScript
Tags: Coldfusion
Sign Up Now!
Solution Provided By: rweil
Participating Experts: 1
Solution Grade: B
 
 
[+][-]03.31.2008 at 03:05AM PDT, ID: 21244209

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.31.2008 at 10:59AM PDT, ID: 21247607

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.31.2008 at 12:15PM PDT, ID: 21248202

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.31.2008 at 03:11PM PDT, ID: 21249638

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628