I am trying to access the the location field in cck with a computed field. I am trying to use the script below. I am wanting to replace the hard coded lat=47 and lng=-122 with location fields.
$request_url = "http://ws.geonames.org/findNearbyPostalCodes?lat=47&lng=-122&maxRows=1";
$xml = simplexml_load_file($request_url) or die("feed not loading");
$zipcode = $xml->code->postalcode;
$node_field[0]['value'] = $zipcode
I have tried without success
$node->locations[0]['latitude']['value']
$node->locations[0]['lat']['value']
$node->locations[0]['latitude']
$node->locations[0]['lat']
$node->locations['latitude']['value']
$node->locations['lat']['value']
$node->location[0]['latitude']['value']
$node->location[0]['lat']['value']
$node->location[0]['latitude']
$node->location[0]['lat']
$node->location['latitude']
$node->location['lat']
$locations[0]['latitude']['value']
$locations[0]['lat']['value']
$locations[0]['latitude']
$locations[0]['lat']
$locations['latitude']['value']
$locations['lat']['value']
$location[0]['latitude']['value']
$location[0]['lat']['value']
$location[0]['latitude']
$location[0]['lat']
$location['latitude']
$location['lat']
Comments
Comment #1
farald commentedThere are multiple issues concerning the use of locations inside computed field:
#350404: Get location coordinates from inside computed field
#370171: Computed field cannot use location values. Any idea why?
#279015: problem accessing location information
The problem is the method location uses to save its data.
Comment #2
farald commentedUse the following: