GoogleMaps.php
public static function coordsByAddress($searchString)
	{
		$result = false;
		try {
			// we must be sure we don't send queries too frequently to avoid be banned by Google Maps API
			if (self::$_googleTimeout != 0) {
				$timeToWait = self::$_lastGoogleSearchTime + self::$_googleTimeout - time();
				if ($timeToWait > 0) {
					sleep($timeToWait);
				}
			}

			$searchResult = self::map()->geoGetCoordsFull($searchString);
			self::$_lastGoogleSearchTime = time();

			if ($searchResult && $searchResult->status == 'OK') {
				$result = [
					'latitude' => $searchResult->results[0]->geometry->location->lat,
					'longitude' => $searchResult->results[0]->geometry->location->lng,
				];
			}
		} catch (ErrorException $e) {
			\Yii::error('Can\'t load coordinates from Google Maps API: ' . $e->getMessage());
		}

		return $result;
	}
public static function coordsByAddress($searchString)
	{
		$result = false;
		try {
			// we must be sure we don't send queries too frequently to avoid be banned by Google Maps API
			if (self::$_googleTimeout != 0) {
				$timeToWait = self::$_lastGoogleSearchTime + self::$_googleTimeout - time();
				if ($timeToWait > 0) {
					sleep($timeToWait);
				}
			}

			$searchResult = self::map()->geoGetCoordsFull($searchString);
			self::$_lastGoogleSearchTime = time();

			if ($searchResult && $searchResult->status == 'OK') {
				$result = [
					'latitude' => $searchResult->results[0]->geometry->location->lat,
					'longitude' => $searchResult->results[0]->geometry->location->lng,
				];
			}
		} catch (ErrorException $e) {
			\Yii::error('Can\'t load coordinates from Google Maps API: ' . $e->getMessage());
		}

		return $result;
	}
public static function coordsByAddress ( $ searchString ) { $ result = false ; try { // we must be sure we don't send queries too frequently to avoid be banned by Google Maps API
 if ( self :: $ _googleTimeout != 0 ) { $ timeToWait = self :: $ _lastGoogleSearchTime + self :: $ _googleTimeout - time ( ) ; if ( $ timeToWait > 0 ) { sleep ( $ timeToWait ) ; } } $ searchResult = self :: map ( ) -> geoGetCoordsFull ( $ searchString ) ; self :: $ _lastGoogleSearchTime = time ( ) ; if ( $ searchResult && $ searchResult -> status == 'OK' ) { $ result = [ 'latitude' => $ searchResult -> results [ 0 ] -> geometry -> location -> lat , 'longitude' => $ searchResult -> results [ 0 ] -> geometry -> location -> lng , ] ; } } catch ( ErrorException $ e ) { \ Yii :: error ( 'Can\'t load coordinates from Google Maps API: ' . $ e -> getMessage ( ) ) ; } return $ result ; }
Search coordinates by address

@param string $searchString search query with address
@return array|bool
Search coordinates by address