Geocoder\Provider\GoogleMaps::reverse PHP Method

reverse() public method

{@inheritDoc}
public reverse ( $latitude, $longitude )
    public function reverse($latitude, $longitude)
    {
        return $this->geocode(sprintf('%F,%F', $latitude, $longitude));
    }

Usage Example

Exemplo n.º 1
0
 /**
  * usage e.g.
  * ```
  * use \dbsparkleTeam\unispot\formatters\AddressFormatter;
  * use \dbsparkleTeam\unispot\components\Location;
  *
  * Location::getAddress(60.023554,30.2232882,[
  *     'type' => AddressFormatter::TYPE_FULL,
  *     'format' => AddressFormatter::FORMAT_NORMAL
  * ])
  * ```
  * @param float $lat
  * @param float $lng
  * @param array $options
  * @return string
  */
 public static function getAddress($lat, $lng, $options = [])
 {
     $curl = new CurlHttpAdapter();
     $geocoder = new GoogleMaps($curl);
     $addressData = $geocoder->reverse($lat, $lng);
     if (!isset($options['format']) || !in_array($options['format'], [AddressFormatter::FORMAT_NORMAL, AddressFormatter::FORMAT_REVERSED])) {
         $options['format'] = AddressFormatter::FORMAT_NORMAL;
     }
     if (!isset($options['type']) || !in_array($options['type'], [AddressFormatter::TYPE_FULL, AddressFormatter::TYPE_SHORT])) {
         $options['type'] = AddressFormatter::TYPE_FULL;
     }
     return AddressFormatter::format($addressData->first(), $options);
 }
All Usage Examples Of Geocoder\Provider\GoogleMaps::reverse