@alsharif
Take a look to plugin code to see what everything it accept:
function insert_geo_location($item) {
$itemId = $item['pk_i_id'];
$aItem = Item::newInstance()->findByPrimaryKey($itemId);
$sAddress = (isset($aItem['s_address']) ? $aItem['s_address'] : '');
$sCity = (isset($aItem['s_city']) ? $aItem['s_city'] : '');
$sRegion = (isset($aItem['s_region']) ? $aItem['s_region'] : '');
$sCountry = (isset($aItem['s_country']) ? $aItem['s_country'] : '');
$address = sprintf('%s, %s, %s, %s', $sAddress, $sCity, $sRegion, $sCountry);
$response = osc_file_get_contents(sprintf('http://maps.googleapis.com/maps/api/geocode/json?address=%s', urlencode($address)));
$jsonResponse = json_decode($response);
if (isset($jsonResponse->results[0]->geometry->location) && count($jsonResponse->results[0]->geometry->location) > 0) {
$location = $jsonResponse->results[0]->geometry->location;
$lat = $location->lat;
$lng = $location->lng;
ItemLocation::newInstance()->update (array('d_coord_lat' => $lat
,'d_coord_long' => $lng)
,array('fk_i_item_id' => $itemId));
}
}