示例#1
0
 private function geolocate($physician)
 {
     $this->countGeolocated++;
     Log::notice('Fetching geolocation data for ' . $physician->full_name);
     $client = new Client('aca4585cbbdf2f8589c58bb4606c56fd45db3bb');
     $data = sprintf('%s, %s, %s %s', $physician->address_1, $physician->City, $physician->State_Province, $physician->Zip);
     try {
         $geoDataRaw = $client->get($data);
         $geoData = $this->parseGeoData($geoDataRaw);
         return $geoData;
     } catch (GeocodioAuthError $gae) {
         Log::warning('Error geolocating ' . $physician['full_name'] . ': ' . $gae->getMessage());
     } catch (GeocodioDataError $gde) {
         Log::warning('Error geolocating ' . $physician['full_name'] . ': ' . $gae->getMessage());
     } catch (GeocodioServerError $gse) {
         Log::warning('Error geolocating ' . $physician['full_name'] . ': ' . $gae->getMessage());
     }
 }
示例#2
0
 public static function geolocate($physician, $log)
 {
     Log::notice('Fetching geolocation data for ' . $physician->full_name);
     $log->notice('Fetching geolocation data for ' . $physician->full_name);
     $client = new Client(env('GEOCODIO_KEY'));
     $data = sprintf('%s, %s, %s %s', $physician->address_1, $physician->City, $physician->State_Province, $physician->Zip);
     try {
         $geoDataRaw = $client->get($data);
         $geoData = self::parseGeoData($geoDataRaw, $physician->full_name, $log);
         return $geoData;
     } catch (GeocodioAuthError $gae) {
         Log::warning('Error geolocating ' . $physician['full_name'] . ': ' . $gae->getMessage());
         $log->warning('Error geolocating ' . $physician['full_name'] . ': ' . $gae->getMessage());
     } catch (GeocodioDataError $gde) {
         Log::warning('Error geolocating ' . $physician['full_name'] . ': ' . $gae->getMessage());
         $log->warning('Error geolocating ' . $physician['full_name'] . ': ' . $gde->getMessage());
     } catch (GeocodioServerError $gse) {
         Log::warning('Error geolocating ' . $physician['full_name'] . ': ' . $gse->getMessage());
         $log->warning('Error geolocating ' . $physician['full_name'] . ': ' . $gse->getMessage());
     } catch (Exception $e) {
         Log::warning('Error geolocating ' . $physician['full_name'] . ': ' . $e->getMessage());
         $log->warning('Error geolocating ' . $physician['full_name'] . ': ' . $e->getMessage());
     }
 }