示例#1
0
文件: Place.php 项目: ruffox/geo
 public function geocodeMe()
 {
     $address = "";
     if (!empty($this->Address)) {
         $address .= $this->Address;
     } else {
         Debug::show("sin dirección no se puede agregar en el mapa");
         return false;
     }
     if (!empty($this->City)) {
         $address .= ', ' . $this->City;
     }
     if (!empty($this->State)) {
         $address .= ', ' . $this->State;
     }
     if (!empty($this->Zip)) {
         $address .= ', ' . $this->Zip;
     }
     $g = new GoogleGeocoder();
     $point = $g->addressToPoint($address);
     if (!$point instanceof GeoPoint) {
         $point = YahooGeocoder::addressToPoint($address);
     } else {
         $this->Lat = $point->Lat;
         $this->Lng = $point->Lng;
     }
     if ($point instanceof GeoPoint) {
         return true;
     }
 }
示例#2
0
 function test_lookup_failure()
 {
     $this->google_full_addr = array('street_address' => "Kalervonkatu 3", 'city' => "Jyväskylä", 'country_code' => "US");
     $this->google_full_loc = new GeoLoc($this->google_full_addr);
     $google_geocoder = new GoogleGeocoder();
     $address = $google_geocoder->geocode($this->google_full_loc);
     $this->assertFalse($address->success);
 }
示例#3
0
 function google_geocoder($address)
 {
     return GoogleGeocoder::do_geocode($address);
 }