Skip to content

Instantly share code, notes, and snippets.

@fillerwriter
Created October 16, 2012 14:16
Show Gist options
  • Save fillerwriter/3899520 to your computer and use it in GitHub Desktop.
Save fillerwriter/3899520 to your computer and use it in GitHub Desktop.
Super-simple script to populate geofield data from addresses
$addresses = array('1600 Pennsylvania Ave., Washington, DC'); //
foreach ($addresses as $key => $address) {
$geocoded_location = geocoder('google', $address); // Returns a geoPHP geometry object, likely a point.
$node->field_geofield[LANGUAGE_NONE][$key] = geofield_compute_values($geocoded_location->out('wkt'));
}
//Node save as usual
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment