src/Net/API/Google/Maps/Geocoder.php
public function getGeoCode( $address, $force = FALSE )
	{
		$address	= urlencode( $address );
		$query		= "?address=".$address."&sensor=false";
		if( $this->pathCache )
		{
			$cacheFile	= $this->pathCache.$address.".xml.cache";
			if( file_exists( $cacheFile ) && !$force )
				return File_Editor::load( $cacheFile );
		}
		$xml	= $this->sendQuery( $query );
		$doc	= new XML_Element( $xml );
		if( $doc->status->getValue() === "OVER_QUERY_LIMIT" )
			throw new RuntimeException( 'Query limit reached' );
		if( !@$doc->result->geometry->location )
			throw new InvalidArgumentException( 'Address not found' );
		if( $this->pathCache )
			File_Editor::save( $cacheFile, $xml );
		return $xml;
	}
public function getGeoCode( $address, $force = FALSE )
	{
		$address	= urlencode( $address );
		$query		= "?address=".$address."&sensor=false";
		if( $this->pathCache )
		{
			$cacheFile	= $this->pathCache.$address.".xml.cache";
			if( file_exists( $cacheFile ) && !$force )
				return File_Editor::load( $cacheFile );
		}
		$xml	= $this->sendQuery( $query );
		$doc	= new XML_Element( $xml );
		if( $doc->status->getValue() === "OVER_QUERY_LIMIT" )
			throw new RuntimeException( 'Query limit reached' );
		if( !@$doc->result->geometry->location )
			throw new InvalidArgumentException( 'Address not found' );
		if( $this->pathCache )
			File_Editor::save( $cacheFile, $xml );
		return $xml;
	}
public function getGeoCode ( $ address , $ force = FALSE ) { $ address = urlencode ( $ address ) ; $ query = "?address=" . $ address . "&sensor=false" ; if ( $ this -> pathCache ) { $ cacheFile = $ this -> pathCache . $ address . ".xml.cache" ; if ( file_exists ( $ cacheFile ) && ! $ force ) return File_Editor :: load ( $ cacheFile ) ; } $ xml = $ this -> sendQuery ( $ query ) ; $ doc = new XML_Element ( $ xml ) ; if ( $ doc -> status -> getValue ( ) === "OVER_QUERY_LIMIT" ) throw new RuntimeException ( 'Query limit reached' ) ; if ( ! @ $ doc -> result -> geometry -> location ) throw new InvalidArgumentException ( 'Address not found' ) ; if ( $ this -> pathCache ) File_Editor :: save ( $ cacheFile , $ xml ) ; return $ xml ; }
Returns KML data for an address.
@access		public
@param		string		$address		Address to get data for
@param		bool		$force			Flag: do not use cache
@return		string
@throws		RuntimeException			if query limit is reached
@throws		InvalidArgumentException	if address could not been resolved
Returns KML data for an address .