data['location']); /* * Don't forget to edit the $GeoCouch->conf parameters! */ $GeoCouch = new GeoCouch(); /* * The all-in-one method. * This geocodes the string and writes it to CouchDB * The second parameter is any other fields other * than the Google data that you want to save along * with this document. * * NOTE: if this address already exists in CouchDB * a new revision is created. * * Returns the CouchDB response, i.e.: * {"ok" : true, "rev":"3825793742", "id" : "dallas-tx" } */ $GeoCouch->save($location, array('custom_field' => 'value')); /* * Simply geo coding. * Does not write to CouchDB. * Returns an Google Geocoded Object. */ $geoObj = $GeoCouch->geoCode($location); /* * Write some Geo JSON to CouchDB. * First parameter is a unique name for the data * Second parameter is the JSON - in * this case the json_encoded $geoObj from above. */ $GeoCouch->put($location, json_encode($geoObj)); /* * Get some existing geo data */ $geoObj = $GeoCouch->get($location); } ... } ?>