How to use geocoding with codeigniter? At the moment I'm using Biostall's Google Maps v3 API -
i want save postal address database co-ordinates guys have idea of how codeigniter , geocoding?
public function save() { $postal = ""; $orgname= ($this->input->post('inputname')); $category= ($this->input->post('category')); $streetno= ($this->input->post('streetno')); $streetname= ($this->input->post('streetname')); $suburb= ($this->input->post('suburb')); $state= ($this->input->post('state')); $postcode= ($this->input->post('postcode')); } $postal = $streetno.' '.$streetname.' '.$suburb.' '.$state.' '.$postcode.' australia'; $geocode=file_get_contents('http://maps.google.com/maps/api/geocode/json?address=$postal&sensor=false'); $output= json_decode($geocode); $lat = $output->results[0]->geometry->location->lat; $long = $output->results[0]->geometry->location->lng; $markers = array( 'name' => $orgname, 'address' => $postal, 'lat' => $lat, 'lng' => $long, 'catagory' => $category ); $postal = ""; $long = ""; $lat = ""; $geocode = ""; $output = ""; $markers_id = $this->home_model->addlatlong($markers);
Comments
Post a Comment