/**
  * get the nearest locations by city
  *
  * @param string $city 
  * @param string $model
  * @param integer $limit
  * @param integer $offset
  * @return array
  * @author Andy Bennett
  */
 public function nearest_city_locations($city, $model, $limit = null, $offset = null)
 {
     $ll = latlon::latlon_from_city($city);
     if ($ll == false or empty($ll->latitude) or empty($ll->longitude)) {
         return false;
     }
     Kohana::config_set('distance.lat', $ll->latitude);
     Kohana::config_set('distance.lon', $ll->longitude);
     return ORM::factory($model)->find_all($limit, $offset);
 }
 /**
  * get the lat/lon from a postcode
  *
  * @param string $postcode 
  * @return false/object
  * @author Andy Bennett
  */
 public function latlon_from_postcode($id = NULL, $postcode)
 {
     $postcode = latlon::clean_postcode($postcode);
     $this->where(array("postcode" => $postcode));
     return parent::find($id);
 }