function test_lookup_failure() { $this->yahoo_full_addr = array('street_address' => "Kalervonkatu 3", 'city' => "Jyväskylä", 'country_code' => "US"); $this->yahoo_full_loc = new GeoLoc($this->yahoo_full_addr); $yahoo_geocoder = new YahooGeocoder(); $address = $yahoo_geocoder->geocode($this->yahoo_full_loc); $this->assertFalse($address->success); }
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; } }
function yahoo_geocoder($address) { return YahooGeocoder::do_geocode($address); }