Development

Changeset 7017

You must first sign up to be able to contribute.

Changeset 7017

Show
Ignore:
Timestamp:
01/12/08 00:20:12 (5 years ago)
Author:
davedash
Message:

sfGeocoderPlugin: fixed the way Google Maps handles Cities (at least for the US)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/sfGeocoderPlugin/lib/sfGeocoderCache.class.php

    r4222 r7017  
    1111    $this->setCacheDir(sfConfig::get('sf_geocoder_cache_dir', sfConfig::get('sf_cache_dir') . '/geocoder')); 
    1212  } 
     13   
    1314  public function getShortString() 
    1415  { 
     
    8182      $this->set($id, '', serialize($result)); 
    8283    } 
     84 
    8385    $this->result = $result; 
    8486    return $result; 
     
    115117      $q['city'] = $c; 
    116118    } 
    117      
    118119    return $q; 
    119120  } 
     
    126127    // country=$c&state=$s&city=$c&zip=$z 
    127128     
    128      
    129129    $q = $this->getCSZAsArray(array('convert_spaces'=>true)); 
    130130     
  • plugins/sfGeocoderPlugin/lib/sfGoogleMapsGeocoder.class.php

    r4222 r7017  
    3737      curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); 
    3838      $response = curl_exec($curl); 
    39  
    4039      // convert response to result 
    4140      $result = array(); 
     
    4342      $xml                 = new SimpleXMLElement(utf8_encode ($response)); 
    4443       
    45       $country             = $xml->Response->Placemark->AddressDetails->Country; 
    46       $state               = $country->AdministrativeArea; 
    47       $city                = $state->SubAdministrativeArea->Locality; 
    48       // var_dump($url); 
    49       // exit;       
     44      $country = $xml->Response->Placemark->AddressDetails->Country; 
     45      $state   = $country->AdministrativeArea; 
     46      $city    = $state->Locality; 
     47 
    5048      $result['country']   = (String) $country->CountryNameCode; 
    5149      $result['state']     = (String) $state->AdministrativeAreaName;