I got my information from a cvs file into mysql.
the data looked something like:

"id","in2008","incurrent","inllli","Name","LastName","AddressLine1","AddressLine2","City","State","ZIP","Phone",
1,,"ad",,"Jane","Smith","100 Main St",,"Chicago","IL",60619,"773-111-1234",

Initially, I chose "node" for the kind of destination, and I created a node type, I called "LeaderMapProfile" but it is just a node that has cck fields, one of which is a cck location field.

When I'm in the content set page, I can choose the source field and map them to the destination field which works ok for my cck field called "First Name", "Last Name", "Phone" but where I would want to map AddressLine1 to Street, or City to City, there is just a CCK: Home Address lid

So, finally the question. Do I need to write hooks to get migrate to "know" about location module stuff?

If I do create content LeaderMapProfile the form shows the Street, City, etc for a human to type into. and saving that, creates all the loctions stuff needed... so I have a hope that whatever gets that to work can be re-used here.

I'll probably need to re-phrase my questions and do more reading, so thanks for any help anyone can give pointing me to resources or helping with ideas.

I'm also going to try and do some screen shots. Thanks.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

YesCT’s picture

screen shots.

summary: I would like what I get in migrate (destinations-pg2.jpg) to look like what I get as a human in create content (add-leadermapprofile-ashuman-pg2.jpg)

:)

YesCT’s picture

related: #459278: Compatibility with migrate module in location module pointing to this issue

YesCT’s picture

YesCT’s picture

There is a location.Inc in the cvs for node import module, could that be a start?

mikeryan’s picture

Assigned: Unassigned » mikeryan
Category: support » feature

What's needed, minimally, is a location.inc in the supported directory to support location fields. Yes, the node_import location.inc would be a good start - migrate's roots are in node_import, although the migrate API is different enough that you won't be able to simply plug it in. If someone implements location.inc, I'll be happy to roll it into the migrate module.

frankcarey’s picture

mike, I have a bunch of other integration modules done. User Relationships, Taxonomy, PrivateMsg, and Userpoints. I'm about to jump on to Location , unless someone is starting a Location integration module? So what should be do with all of these addon modules? See forthcoming issue

YesCT’s picture

I have not started on location.

Do you have plans to do all or only one of (native) user locations, (native) node locations, cck locations? I might be revealing how little I know by asking.

Do you have a vision for the interface? Something like showing the allowed or required or all location fields detected allowed when picking a content type, like user, or story if those had settings to enable a location? I'm guessing that multiple locations per content type would be confusing for a first pass.

It probably doesn't have too much of an effect, but I'm looking for just cck locations with only one location per content type. And ignoring the allowed, required, not allowed fields is probably the way to go because the admin that is using migrate would be able it figure out to just leave the fields empty they did not want to allow.

Another mehod I was thinging of was having the lid, nid, genid, vid, in the table to be imported, then if for example I was importing a content type called bearstomap that had a cck location field, the import would happen in two passes. One would be like it is now, importing the fields for bearstomap filling in the lid number. Then in a second pass, importing just "locations" which would be matching up the lid, genid, vid, nid and others actual location info like street address, city, zip, long, lat, etc.

Well I hope my musings help and not hinder!

frankcarey’s picture

the way i envision is that you would have a database table of locations, and using table wizard, you'd map the old content id's to either new user ids, or new node ids. Then the migrate module would go through the list, adding locations to your existing content (or previously imported).

I'm not as familiar with Location CCK, is that part of the Location module or does it do it's own thing for storage?

frankcarey’s picture

If location cck is storing info as cck fields, it might make more sense to import that data when you are saving the node/user intially. You can bring in the additional info in the hook_mirgate_destination_prepare_TYPE() hook function that migrate provides. Then you just add that info to the node or user object and it gets saved along with the node. You don't get automatic mapping of lid, etc this way, but you can just create your own mapping table. This is how i did files, and it worked reasonably well.

YesCT’s picture

Issue tags: +location importing

Any progress? If you have any code you want help testing or reviewing, let me know.

(also tagging, as someone asked about this in the location queue ...)

frankcarey’s picture

Yes, I've got it written (last week). It imports User Locations (if enabled), or Node Locations. However, it doesn't use CCK Locations. It also the clean/delete functionality isn't quite working yet (i've just been truncating tables). The module assumes you have existing nodes, or nodes you have imported that you want to create locations for, so it takes nid of the existing node (uid for users), lat, long, and all the other fields available in the API.

I would think that if you wanted CCK locations, Imported AS you import your nodes, that a wholly different method would be required, similar to the current cck integrations such as date, etc.

Mike, do you know if the CCK integration stuff can be added to from another module?

If the module works for you as is, I'll post a zip file of the module as I have it now.

stefan81’s picture

Is the location compatibility implemented in the newest release?
Or is the code you "got written" a patch, published where?

markun’s picture

Hi there,

any changes on that?

Thx,
Pedro Markun

mikeryan’s picture

No one has contributed location module support to the migrate module (or, as far as I can see, migrate module support to the location module...).

frankcarey’s picture

i had a working version, but it needs to be upgraded and refined. Work is starting on this again this week, so keep an eye out for it. (bug me)

jerodfritz’s picture

Any updates on your contributions to add location support?

Thanks,
Jerod

scalp’s picture

Is this available yet?

ryan88’s picture

Any chance this will be available soon? I don't even care if it is not tested, I would like to be able import my database into drupal soon.

mikeryan’s picture

Project: Migrate » Migrate Extras
Version: 6.x-1.x-dev » master
Assigned: mikeryan » Unassigned

The best place for migration support for contrib modules is in the contrib module itself. The second-best place is the Migrate Extras module, and Frank does have an implementation there (I haven't tested it though, I haven't used the Location module myself).

scalp’s picture

The Migrate Extras module still shows integration with the Location module as being tested. Does anyone know when this will be available? I'd be willing to offer a small bounty to help this move along faster.

BenK’s picture

Subscribing....

frankcarey’s picture

Title: kinds of destination: location (location module: node location or cck location field) » Location Integration
Assigned: Unassigned » frankcarey
Status: Active » Fixed

OK, worked on this last couple days. Should be ready to go. Note, this is just the location module integration. Location user is almost identical, but would still need to be done. CCK is a little more complex, but still creates creates a location with an lid, and then maps the CCK field entry to it.

The module needs to be enabled in the migrate settings. Make sure you have the latest dev version of migrate, since it has the hook_migrate_api() code in it. Please test and if there are bugs, please make a new issues.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

frankcarey’s picture

Component: Code » Migrate Extras Features

Note: if you get EMPTY LOCATION errors trying to import US, country-only locations... see this post and patch for location module #730730: Default country location should not be 'us' but blank

YesCT’s picture

I'm coming back to this. Where does the time fly?

re #22
is the dev version of migrate still needed?

and to clarify, location cck is still not written yet, but you are saying it could be similar to what is already written?

YesCT’s picture

adding location migration extra tag.

YesCT’s picture

FileSize
55.97 KB
83.16 KB
63.75 KB
80.16 KB
42.69 KB
38.08 KB
52.21 KB

I tried enabling the location node location module, and the migration support extras "Support for the location module." setting.

but I dont get to pick a mapping for city, state, zip, etc.

I attached some screen shots.

YesCT’s picture

Version: master » 6.x-1.0-alpha2
Status: Closed (fixed) » Active
FileSize
55.97 KB

oops. didnt mean to attach a file.

frankcarey’s picture

Because locations aren't a CCK field, and you may want to import more than one location per node. "Location" is the content type that you want to use, not "Node: FooBar". It should be listed when you make a new content type. What you'll need is a view that has the NEW node id of the node you want to add a location to and then all of the location fields you want to import across the row. To get the NEW nid, I add a relationship in tw to add the master node map table (an option in migrate extras settings). I do the same things for importing comments, etc. Let me know if it works for you. I also just implemented user_location as well, and that will get out to the module when I can find some time. (bug me if more than 2 weeks)

YesCT’s picture

hmm. So to use the location migration extra, I would need to actually import "locations", not do it all in one go as importing nodes that have locations?

(just repeating to make sure I'm understanding what you are saying. thanks for being patient!)

then you go on to describe how to hook those locations together with the nodes eventually (the view and the relationship). If you ever make a video, of a small example, post a link to it. :) It's a bit hard for me to wrap my head around.

frankcarey’s picture

the first part you have right but let me clarify the "how to hook those locations together with the nodes eventually" Let's say you have some locations a simple example would be

sourceid | country
123      | us  

So you've already imported sourceid 123, which is now node (nid) 567. When you import, you need to use nid of 567 (not 123). You can do this by using a relationship in views to a map table. So you are able to create a view that looks like

sourceid | country | destid (nid)
123      | us      | 567

and then you set the nid field to the destid and it will import the location into the right node.

stella’s picture

Status: Active » Needs review
FileSize
11.83 KB

Attached patch adds location_node support. I also made some code style fixes while trying to get my head around the existing code.

YesCT’s picture

Wait, I thought location node was already in, and location user and location cck were not done yet?

YesCT’s picture

@stella, looks like in the patch are a bunch of deletion and additions of lines that are just due to spacing changes (taking out or adding spaces or tabs or something).

If you are making changes to bring it up to coding standards, that might be easier to commit if it were separate, than functional changes? Or if you are just trying to get the functional changes in the code in, it would be easier to review if you left the white space the same, so the patch only showed the lines of code you changed....

stella’s picture

FileSize
23.39 KB

Hmmm not in the version I'm using which is the alpha2 one. It has the ability to migrate locations as an entity by themselves, and not as part of a node migration.

I've updated the patch to handle both location_node and location_cck. Could probably be improved upon / tidied up, but seems to work. We should probably also add support for location_phone and other add-on modules, maybe by calling location_field_names() to populate the list of fields instead, but that's for another day/issue.

stella’s picture

FileSize
4.68 KB
14.15 KB

oops, wrong patch. Here's the updated one - both with and without the style fixes. Take your pick.

YesCT’s picture

sweet. I'll take a look.

bsnodgrass’s picture

--subscribing

frankcarey’s picture

I'll take a closer look shortly. I also added user_location integration as well on my local version.

YesCT’s picture

I tested out the patch (the one with no style fixes) in #36 and it was great!
I commented out my custom code in mymodule:
function mymodule_migrate_prepare_node(&$node, $tblinfo, $row) {...}
Went into the migrate extras tab and expanded the extras fields set, and checked the location one.
Then, I went back to the migrate dashboard, and when I picked a set, there were cck location fields there to match up source and destination!

It was great!

I tried a few different imports and sets, and the only time I had trouble was when my data coming in did not have a country field and I tried to specify a default (of US, and I tried us too). It did not set the country. But when I put a column in my data coming in for country, and picked it for the source of the location cck country field, it did pick up the "US" and set it correctly. I did try a default for the street and that worked. So I'm not sure what happened.

So this is a functional review and it looks great. If someone gives a code review I think this could be committed to a dev to get more eyes on it.

(I was going to test the country default thing again, but my host is having trouble, so I'll have to just leave that for now.)

frankcarey’s picture

great! I'll push the current dev into a new release and then start adding these features to the dev version. Tour issue with location country being US, is probably related to this problem: #730730: Default country location should not be 'us' but blank and #349877: Can't save a location which is just the default country

YesCT’s picture

frankcarey this sounds fantastic!

and just wanted to clarify, I was importing city, state and zip (matching source and destination with the new cck location gui) and typing US in the form as the default country; not setting only the country... I'll try and do a retest to see if I can get the problem to repeat, and video it, and post it here so someone can see just what I did.

Yeah! I'm excited!

frankcarey’s picture

I'd like to see location_cck stuff pushed out to it's own include (see #753048: location_user integration )

YesCT’s picture

brainstorming ... maybe could set up something using migrate extras location integration to do #375259: Add a migration functionality to migrate locations from node/user locations to cck locations old style locations (node locations) to cck location

azoho’s picture

Comment #40 - importing multiple line addresses into a Node: Location CCK field, how is this done exactly?

We're finding the content set only has a single 'CCK: Location lid' option in the destination field column, with AddressLine1,AddressLine2,City,State,ZIP to select from in the source field column.

How do you get the different lines of addresses from the source mapped to the fields in Location CCK?

Using migrate_extras 6.x-1.0-beta1, and Location 6.x-3.x-dev (2010-May-20)

Thanks

YesCT’s picture

I think I just mapped my "street" to the location cck one, my "zip" to the location cck field .... You dont see the individual parts of the location cck field when using the migrate extras? ... I'm trying to remember, maybe there is a patch for the migrate extras to get it to work with location cck...

eff_shaped’s picture

subscribing (hi alan :)

YesCT’s picture

here is the patch. it's not in dev of migrate extras yet.
http://drupal.org/node/459236#comment-2757412
#459236: Location Integration

osu_bucks’s picture

Version: 6.x-1.0-alpha2 » 6.x-1.x-dev
Category: feature » support

Hi All,

Sorry, I'm a newbie. But... will this allows me to map my location to the gmap? Hmm... so I have a csv with address, city and zip, and I'm trying to import with table wizard and migrate to plot my location on the map. So far, I have everything imported, but I'm banging and scratching my head at the moment :)

thanks,

mikeryan’s picture

Migrate and Migrate Extras V1 are no longer supported. Location support for V2 is now consolidated to the following issue:

#943178: Implementation of Location support for Migrate Extras V2

mikeryan’s picture

Status: Needs review » Closed (duplicate)