JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old April 9th, 2010, 05:27 AM
gurkus gurkus is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2010
Posts: 5 gurkus User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 10 m 46 sec
Reputation Power: 0
Problems with Google Geocoder in javascript

Can someone explain why this codes doesn't run? I have manged to get locations out of a SQL database using php and then transfering it to a javascript array but I want to send this information into a google geocoder to post it to a map. I seem to be having conceptual issues with google geocoder, ive read the API by im ability to understand everything so far is apparently too limited and I can't get access to the google forums, I think it has to do with me being in China.

Code:
for (i = 0; i <= iplist.length-1; i++){ geocoder.getLocations(address, addToMap);	}


Code:
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">

  var map;    
  var iplist = new Array();
  var address = "China";
/*
 
	mysql_connect('gierkep.ipagemysql.com', 'trackmaster', 'xia8xiao');
	mysql_select_db('ipaddresses_1');
	$link = mysql_connect('gierkep.ipagemysql.com', 'trackmaster', 'xia8xiao'); 
	if (!$link) 
	{ 
		die('Could not connect: ' . mysql_error()); 
	}  

	mysql_select_db('ipaddresses_1'); 

  	$countrytest = 'SELECT * FROM `iplocations`';
	$countryquery = $countrytest;
	$moreresults = mysql_query($countryquery) or die(mysql_error());
	$x = 5;
  	while($row = mysql_fetch_array($moreresults))
  	{   	
		$countryinstance = $row['country'];
		echo "\n" . "iplist.push(" . json_encode($countryinstance) . ");" .  "\n";

	}
  ?>*/
  
  <?php
	
  $listofips = array( 
				array((string)("0"), (string)("0"), (string)("Number 1")),
               	array((string)("50"), (string)("50"), (string)("Number 2")),
				array((string)("50"), (string)("-50"), (string)("Number 3")),
				array((string)("-50"), (string)("50"), (string)("Number 4")),
               	array((string)("-50"), (string)("-50"), (string)("Number 5")), 
               	array((string)("50"), (string)("100"), (string)("Number 6")),
				array((string)("-50"), (string)("100"), (string)("Number 7")),
				array((string)("50"), (string)("-100"), (string)("Number 8")),
               	array((string)("-50"), (string)("-100"), (string)("Number 9"))
             ); 
  	$entrycount = count($listofips);
  	for ($x = 0; $x <= $entrycount -1; $x += 1)
  	{ 
  	
		echo "\n" . "var ip = new Array(" . $listofips[$x][0] . ", " . $listofips[$x][1] . ", " . json_encode($listofips[$x][2]) . ");" . "\n"; 
		echo "iplist.push(ip);" .  "\n";

 	}
  ?>
  function initialize() 
  {

    var latlng = new google.maps.LatLng(0,0);
    var myOptions = 
	{
    	zoom: 1,
    	center: latlng,
    	mapTypeId: google.maps.MapTypeId.HYBRID
  	}
   
   	map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
	
	
	alert('geocoder function about to call');
	alert(window.location.host);
	//Print all the markers here
	for (i = 0; i <= iplist.length-1; i++)
	{
	
		var yourlat = parseInt(iplist[i][0]);
		var yourlng = parseInt(iplist[i][1]);
		var text =  iplist[i][2];
		text.toString();
		var point = new google.maps.LatLng(yourlat,yourlng);
		var marker = new google.maps.Marker
		({
			  position: point, 
			  map: map, 
			  title: text  
		});
	
	}
		//for (i = 0; i <= iplist.length-1; i++){ geocoder.getLocations(address, addToMap);	}
  }
  function addToMap(response)
   {
	alert('geocoder function called');
	var text =  "Rollover Text Under Development";
	text.toString();
	var point = new GLatLng(place.Point.coordinates[1],
                          place.Point.coordinates[0]);
	var marker = new google.maps.Marker({
		  position: point, 
		  map: map, 
		  title: text
  	});
   }
</script>
</head>
<body onLoad="initialize()">
  <div id="map_canvas" style="width:550; height:400"></div>
</body>
</html>

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJavaScript Development > Problems with Google Geocoder in javascript


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap