In trying to import into a content type with location information, only Location:Country, Location:Latitude and Location:Longitude are available from the drop down list in field-matching.

Comments

jcamfield’s picture

In node_import/supported/location.inc
commenting out as follows seems to fix this (perhaps a bug caused by the latest location.module?)

Line 12:

$fields = array();
foreach ((array)location_field_names() as $field => $fieldname) {
/** if (variable_get('location_'. $field .'_'. $type, $field == 'country' ? 1 : 0)) {
*/
$fields['node_import_location_'. $field] = t('Location: @fieldname', array('@fieldname' => $fieldname));
/** }
*/
}

jcamfield’s picture

Status: Active » Needs review

Patch at http://drupal.org/node/297009 seems to work.

baobab’s picture

confirm that it works for Location v.5x-3.0-rc2. Brilliant thank you.
For those who use Location v.5x-3.x-dev import didn't work for me.

uksigma’s picture

Version: 5.x-1.5 » 5.x-1.9
Status: Needs review » Needs work

cross post from http://drupal.org/node/297009

Having had the location.inc file fix this bug work with the location.inc from #2 on the above link

and then updated location module today with location 5.x-3.0 (http://drupal.org/node/346395) the node import is not displaying all the location fields again

random_tom’s picture

Same problem exists for me i.e. node import does not recognise location fields. I have tried patch (#2) and the other solutions posted in this queue and the location queue. Still no joy though.

I'm testing on: Drupal 5.10 | Node Import 5.x-1.9 | Location 5.x-3.0

Any solutions or a point in the right direction would be gratefully appreciated.

jessicakoh’s picture

subscribing.

jessicakoh’s picture

I tried the method from #1.

It works.

Thank you, jcamfield.

jessicakoh’s picture

I am able to see the missing location fields, however, it does not seem to be able to import those fields.

internets’s picture

I'm having the same issue using latest versions(dev for location) of all related modules. I tried fixes from previous comments without success.

When I go to map the fields for importing a csv file, location lat / lon / country show up. But Location address, state/province, zipcode, phone, fax etc do not show up.

I'm using the location field within a CCK if that make any difference.

erem’s picture

#1 works for Node Import 5.x-1.9 / Location 5.x-3.0 : the fields show up on import menu.

HOWEVER data is not imported. See also http://drupal.org/node/297009#comment-1271766 since that doesn't work either.

jayjaydluffy’s picture

i applied #1 but like mostly said it displayed the entire "location:" fields BUT doesn't import anything.

but i did not even reach to that point when i encountered this error

Fatal error: Call to undefined function _location_province_select_options() in /home/smsadler/public_html/spnew/sites/all/modules/node_import/supported/location.inc on line 167

does everyone who did say that it still didn't work encountered this error too?

any update on this issue? it has been driving me crazy...anyone who has a workaround (except for backporting), pls share it here...

thanks

internets’s picture

I was having issues with this and tried the fixes in the related threads without success.

Since my site is in early development, I was able to switch to drupal 6 and all the latest 6.x modules and was able to import my location nodes without issue, and have them plotted on a gmap.

I know this isn't a fix... But switching to the latest versions of everything worked for me...

YesCT’s picture

Title: Location Fields not showing up » Location Fields not showing up (need updated patch for import with Node Import Module to Location Module 5.x)
Issue tags: +location importing

marked #297009: All Location Fields Don't Appear when Using Node Import Module as a duplicate of this issue. (it had a patch that seems not to work with the newer versions)

techutopia’s picture

subscribing.

YesCT’s picture

Internets, did you use the Inc file win 6.x ?

If someone could post an example/instructions for location 6.x that would be great. Also did people get this to work with node locations or cck locations?

Thanks.

Summit’s picture

Subscribing, +1 for D6 version.

EDIT: Interesting..it seems that node_import AND feedapi with feedapi_mapper_location have the same issues. It seems very difficult to get somehow location fields filled with data from an import...
In D6 also problems in this perspective.

EDIT2: Still having problems with location latitude and longitude info. does somehow $node->{$field_name}[$i]['inhibit_geocode'] = true; has to do with this. As stated on: http://groups.drupal.org/node/27864#comment-94876 (Fix 3) Translated from dutch, If you give yourself latitude and longtitude info, the location module screws it...

Greetings, Martijn

hampshire’s picture

I am using Node import 1.9 & Location 3.0 with Drupal 5.22. I have read through the available threads and they seem to just lead me back and forth between each other without a solution for the current versions. Is this the case or am I missing something as I have tried all the solution here and none seem to work.

Thank you.

YesCT’s picture

check out the migrate extras module which now has location (and soon location cck) support
http://drupal.org/project/migrate_extras
http://drupal.org/node/459236#comment-2757412

javi-er’s picture

In case someone still have problems importing location latitude and longitude in Drupal 5, I looked to this issue and after comparing location module and node import implementation I found that there are a couple of variables that node import doesn't set.

Node Import will correctly import location lat and long with this small change, in line 127 of location.inc of node_import replace this:

  if (!empty($location)) {
    $node->locations = array(0 => $location);
  }

with this:

  if (!empty($location)) {
    $location['locpick']['user_latitude'] = $location['latitude'];
    $location['locpick']['user_longitude'] = $location['longitude'];
                    
    $node->locations = array(0 => $location);
  }

I'm using Node Import 5.x-1.9 and Location 5.x-3.1-rc1

doublejosh’s picture

Not able to pull in locations when doing a user import :(
Fields do not appear.