Guest User

Untitled

a guest
Jun 20th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. private function _geocode_items($items) {
  2. $items_to_geocode = array();
  3.  
  4. foreach ($items as $item) {
  5. $items_to_geocode[] = array(
  6. 'id' => $item->id,
  7. 'country' => trim($item->country),
  8. 'postal' => trim($item->postal_code),
  9. 'text' => trim($item->location),
  10. );
  11. }
  12.  
  13. $geocoded_data = $this->_three_taps->geocodeAll($items_to_geocode);
  14.  
  15. if (empty($geocoded_data)) {
  16. return false;
  17. }
  18.  
  19. $geocoded_items = array();
  20.  
  21. foreach ($geocoded_data as $item) {
  22. $geocoded_items[] = array(
  23. 'location_code' => $item[0],
  24. 'latitude' => $item[1],
  25. 'longitude' => $item[2],
  26. );
  27. }
  28.  
  29. return $geocoded_items;
  30. }
Add Comment
Please, Sign In to add comment