[Map-Module] Cannot get info from Google Maps

bjo

Joined: 2007-02-13
Posts: 5
Posted: Tue, 2007-02-13 18:04

Hello,

I'm running the Google-Map-Module 0.5.1d with Gallery 2.1.2 as a multisite installation.

The module es working fine, except getting coordinates by address: "Cannot get info from Google Maps"

The url of the Gallery is http://photos.bjo.nord-west.org

TIA
bjo

 
bjo

Joined: 2007-02-13
Posts: 5
Posted: Tue, 2007-02-13 19:38

It seems the problem is caused by allow_furl_open off - but i don't want to change it for the whole gallery.

 
Termitenshort
Termitenshort's picture

Joined: 2005-10-09
Posts: 1894
Posted: Wed, 2007-02-14 13:56

I have been thinking of using the built-in Geocodeer in Google Maps but I won't be doing this as it does not allow to encode UK and China address.

Right now the only good way is to use furl_open, I'll see if I can make it work with curl instead but other than that ... there really isn't a lot of choices here :-)

See you !
-------------------------
The Termite - :-) - http://www.termitenshort.com/

 
bjo

Joined: 2007-02-13
Posts: 5
Posted: Thu, 2007-02-15 01:59

Thanks for the idea with curl ;)

I tried a bit with curl, now the module gets the coordinates.

$url = "http://maps.google.com/maps?q=".$correctedaddress."&output=js";

	$ch = curl_init($url);
	$fp = fopen("coords.txt", "w");
	curl_setopt($ch, CURLOPT_FILE, $fp);
	curl_setopt($ch, CURLOPT_HEADER, 0);
	curl_exec($ch);
	curl_close($ch);
	fclose($fp);
      
	  $file="";
     
	@$filepointer = fopen("coords.txt","r");
          if($filepointer){
          while(!feof($filepointer)){
             $buffer = fgets($filepointer, 4096);
             $file .= $buffer;
          }
          fclose($filepointer);

I had to change $coords = $match[2].",".$match[1]; to $coords = $match[1].",".$match[2];, otherwise the coords were interchanged.