I'm trying to programmatically create a node with a location field, but I'm not able to do it. I have done it in a similar project and it works fine. I use the Entity API module to create the nodes, with this code.
$localizationmap = array( 'latitude' => $item['field_mapa']['latitude'], 'longitude' => $item['field_mapa']['longitude'], //other elements added here (province, postal_code, country [es, en,...],additional, ...) ); $entity->field_mapa->set($localizationmap);
I checked the values that are given to the array and they're OK. Drupal log contains the following error:
EntityMetadataWrapperException: Unknown data property field_mapa. en EntityStructureWrapper->getPropertyInfo() (línea 335 de /var/www/vhosts/drupal/litoral.interdigital.biz/sites/all/modules/entity/includes/entity.wrapper.inc).
field_mapa exists and it is the name of the location field I'm trying to fill.
What am I doing wrong?