Thanks for this great module. Looks very promising to handle and show geolocations linked to nodes.
Comparing with other's functionalities, I noticed that still there is no support to the very spread and used Feeds module.
It means no Geolocations fields definition are shown in the mapping process.
Sorry, as my php/drupal programming level is not enough to implement this, but I think this should be done soon (if possible), and probably the way the Geofield module did would be as an easy guide: in its case it is implemented by the "geofield.feeds.inc" file ... I attach it here.
Thanks
Comments
Comment #1
zoltán balogh commentedYes, it is a very important, subscribe. I will try to implement.
Comment #2
itamair commentedAny news on this front?
I was looking at the geofield integration with feeds, based on its geofield.feeds.inc component, here attached ...
Probably it would be a good schema to replicate. I will try to investigate, but so far my programming skill in Drupal aren't so good to quickly make it by myself ...
Comment #3
itamair commentedOk. I did it ! ... following the geofield.feeds.inc logic, and seems to work for me.
To implement Feeds integration in Geolocation it is sufficient to add the geolocation.feeds.inc file here attached ... (in .zip version) in the module folder.
Nothing more needed, as it seems ...
Comment #4
itamair commentedComment #5
itamair commentedComment #6
milesw commentedThanks, patch #5 worked perfectly for me using Feeds alpha4. Setting the issue as 'needs review'.
Comment #7
asb commentedIf I put the extracted include file from #5 in the "mappers" subdirectory (and not in "feeds" module's folder), i can map lat and lon in the Feeds mapper. If I try to import a file with 22k lines, the importer responds: "No imported items." The Log is empty. So either the code, or the usage instructions need work.
The CSV file I'm trying to import is:
The data is supposed to go into taxonomy, where matching fields have been created.
Comment #8
asb commentedAttaching exports of the Feeds importer definition, and the taxonomy bundle structure.
Comment #9
flexgrip commentedLooks like this is for nodes and/or taxonomy geolocation fields. I have geolocation fields attached to "Profile2" entity types, and this patch does not give me the option to select any locations for this feed import.
I am going to try to edit the mapper from #5, but this is the first time I've ever even looked at feeds, so I'm a little green. Any suggestions would be appreciated.
My thoughts are, its using hook_feeds_node_processor_targets_alter() and I probably need it to use hook_feeds_user_processor_targets_alter(). I noticed if I changed this to a "node" processor in feeds, I get the option for the geolocation fields that I have attached to nodes. So I'm hoping I can just point this towards the direction of the user processor.
Comment #10
flexgrip commentedIts looking like they all use the same hook, whether its a node or a user. I've only found a few references to the user version of that target alter hook.
At this point I'm struggling to understand why this field is treated different whether its attached to a profile2 profile or a node. I actually found a patch for feeds that gets all of the entity bundles from profile2 fields. Once I applied it, all of the profile2 fields were available to me, however, the geolocation field I have is not in this list.
So no matter which why I slice it, its like feeds does not see the geolocation field when attached to a profile2 profile. Only as a node.
I only need to do this once, so I'm hoping I can maybe just import these into the database manually or something.
Comment #11
vandana commentedSolution in #5 works.. To implement Feeds integration in Geolocation module, added geolocation.feeds.inc in the module folder
Comment #12
fabien77 commentedHi,
I import some projects in xml format and it works fine for me when I have values for lat and lng
But when the projects have no values for lat and lng I get the following error:
SQLSTATE[01000]: Warning: 1265 Data truncated for column 'field_geo_station_lat' at row 1Any idea?
I used #5
Comment #13
fabien77 commentedAm I the only one to get this error when no values are provided from latitude and longitude with #5?
Comment #14
stijnstroobantsI cannot get it working.
I uploaded the patch-file in answer #5 to mydomain.com/sites/all/modules/geolocation/modules/geolocation.feeds.inc
After this the Geolocation-field is not showing up in the Mapping-target dropdown.
I'm using all the latest versions of the modules.
What am I doing wrong? :-)
Thanks,
Skyflyerke
Comment #15
FreeFox commented@skyflyerke
The patch should go in the .../modules/feeds/mappers directory (in my case unzipped)
When the patch is there and you did a cache flush, the field should be visible in the mapper.
Comment #16
CosticaPuntaru commentedA support for a single column comma separated will be useful in some cases
Comment #17
newtoid#5 Worked for me, super useful fix, thanks!
Comment #18
interdruper commentedPatch provided based on #5, but with patch format.
It adds support for multi-valued fields on the feeds import.
The patch creates a new file (geolocation.feeds.inc) in the Geolocation directory.
Since Feeds 2.x, Feeds locates and uses feeds plugins provided by the custom modules,
so there is no need to copy anything to the Feeds module directory.
Comment #19
franz#18 works great, and as far as I can tell as Feeds maintainer, this is the right way to do it. This should get commited.
Comment #20
jkingsnorth commented+1 for #18 - RTBC+
We're using this in a project now and it seems to be working well. Would be a great feature to add to the module!
Comment #22
derjochenmeyer commentedThanks! Committed to 7.x-1.x-dev
Comment #23
derjochenmeyer commentedComment #24
cycas commentedTesting this, if the lang or lat field is empty, or doesn't have the full 8 numbers after the point, I'm getting:
SQLSTATE[01000]: Warning: 1265 Data truncated for column 'field_place_on_map_lat' at row 1
and the record does not import.
It might be nice to add an error message that would make it a bit clearer exactly what the problem is here and explain that you will have to remove the mapping if you want to import records without populating the geolocation field?
Comment #25
interdruper commented@cycas,
the problem that you have found is common importing multi-column fields (like Geolocation) where some of the columns cannot be empty, and cannot have a wrong format, if the field contains any data.
The checking that you are asking for cannot be done in the feed processor, because Feeds module does not contemplate that processor plugins could notify to discard an item, if some check is not passed. The processor always have to return a value, since it has been called from Feeds.
So inside the feeds processor in this case, if for example, the longitude is wrong or empty, it has no sense to return (lat,0) pair.
The way to handle these cases is to use the hook_feeds_presave() to discard/modify those items that will trigger a database error. Or perhaps some plugins available in the Feeds Tamper module may suit your needs.
Comment #26
jkingsnorth commentedI was hitting this error too. It was actually quite useful for me because it highlighted, in the Feeds log, several pieces of content that had invalid (sometimes just barmy) data in the lat/long fields I was trying to import.
I agree with interdruper that Feeds Tamper or a custom presave hook would be the best way to weed out empty/invalid imports.
Comment #28
migajos commentedHi,
I've spent few hours on this one :|.
I was exporting coordinates from Location module to Geolocation Field module.
1. First I've exported coordinates using a View (copied data from table display to Calc/Excel table). Than I've saved it as CSV file (remember to set UTF-8 coding and "," as separators. Use no header, and remember to set the same in importer settings.
2. Than used #18 patch to allow feeding geolocation fields.
3. In CSV file used the following lat/long format: X.XXXXXXXX (I've had to add "00" to each record because Location module provides coordinates with 6 numbers after the point).
My CSV row looked like: A,X.XXXXXXXX,Y.YYYYYYYY
Where:
A - unique UID
X.XXXXXXXX - latitude
Y.YYYYYYYY - longitude
4. Imported the file with /import