In case you are using 7.x-2.0-dev version of geofield you need to change the field structure using ['geom'] and ["input_format"], see attachment
array(1) {
["und"]=>
array(1) {
[0]=>
array(2) {
["geom"]=>
array(3) {
["geo_type"]=>
string(5) "point"
["lat"]=>
string(9) "41.895466"
["lon"]=>
string(9) "12.482324"
}
["input_format"]=>
string(7) "lat/lon"
}
}
}
In your migration class you should define
in constructor:
$geo_arguments = array(
'lat' => array('source_field' => 'profile_lat'),
'lon' => array('source_field' => 'profile_long'),
'input_format' => array('source_field' => 'field_source_geotype_input_format'),
);
And in prepareRow
$row->field_source_geotype_input_format = 'lat/lon';
| Comment | File | Size | Author |
|---|---|---|---|
| geofield.inc_.patch | 940 bytes | marco.giaco |
Comments
Comment #1
sheldon rampton commentedGeofield migrations were failing for me using Geofield 1.2. I was able to get them working by updating to Geofield 2.0 and then applying this patch to Migrate Extras.
Comment #2
scottrouse commentedThis works, but it took me a while to figure it out.
Reviewing the comments in the
migrate_extras/geofield.incfile, we configure an array of arguments inside our constructor:Note that
LatitudeandLongitudeare the names of the respective fields from my source data.Per the comments in the
migrate_extras/geofield.incfile, the geometry type should be passed in as the primary valueNote that
pointin the snippet above didn’t exist in my source data, so I define it inprepareRow().In your
prepareRow()function, we need to define two more “rows” that we’re referencing above (geotype_input_formatandpoint):Comment #3
scottrouse commentedComment #4
Miguelos commentedI used this code and got this error:
Using subfield notation:
Also I tried with the patch proposed in #1411836: Field handler for Migrate module but I had to modify it to got it working with 'lat/lon' input_type. This worked for me fine.
Comment #5
fonant commentedThat could be written more simply as
Comment #6
philipz commentedI really can't make this work. I've tried all combinations listed here and #5 looks best but still nothing.
Has anyone a suggestion on how to debug this one?
Using Geofield 7.x-2.1, Migrate Extras 7.x-2.5+4-dev.
Comment #7
philipz commentedI can't see any subfield named:input_format. Maybe something changed now?Sorry I thought the patch was no longer needed :) This really should be commited!
Comment #8
philipz commentedI think this is a major bug, maybe not for whole Migrate Extras but definitely for Geofield.
If it will not be commited here then should we move this to Geofield issue queue?
Comment #9
mpdonadioDoes this patch work with multivalued geofields? When I try to use it, I end up with
which is because my prepareRow() is building up a lat and lon array to pass in for the subfield mapping.
Comment #10
glueckskind commentedThe patch and #2 worked for me.
Comment #11
szeidler commentedDoesn't work for me using geofield 7.x-2.3, migrate 7.x-2.6 and migrate_extras 7.x-2.0-dev.
I got it working fine with the patch #17 from the geofield issue list: https://www.drupal.org/node/1411836#comment-9180687
Comment #12
milos.kroulik commentedI also managed to make it using the patch mentioned in #11
Comment #13
summit commentedHi,
Shouldn't Geofield Migrate be moved out of Migrate Extra because of https://www.drupal.org/node/1411836#comment-9180687?
greetings, Martijn
Comment #14
duaelfrI can confirm the patch works.
Until the Geofield module has its own migrate support, we should keep it in migrate_extras and commit this fix.
Thanks for reporting and fixing it.
Comment #15
zeip commentedThe patch seemed to be working, although I decided to instead use the patch for Geofield instead. Perhaps this could be committed to the VCS as it is RTBC?