Closed (fixed)
Project:
Geofield
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
7 Aug 2011 at 20:16 UTC
Updated:
13 May 2014 at 17:46 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
ekes commentedI've worked on the feeds integration a bit today. Patch attached. Some explanation of what what and why:-
geofield_compute_values()was never invoked.Because of #1 I removed most of the targets as just confusing. I couldn't find any point where all values would be saved. For example mapping the lon and lat (of which there maybe multiple), you don't know when to call geofield_compute_values(). I left WKT, because if anyone has a source, you can call compute values for this.
To create a point where you do know you have all the values to be able to call geofield_compute_values() I created a new 'source'. This has the bonus of hiding the complexity from the user; but I guess will mean adding new alternative formats into the code in the future.
Comment #2
phayes commentedI think it makes sense that WKT vs. Lat/Lon vs. bounding box are treated as seperate sources / ways that data can be imported. Obviously WKT is the most powerful, but it also makes sense to support Lat / Lon points. I think this is a great start
Comment #3
jeffschulerThanks, ekes!
The patch in #1 is working for me with CSP and geofield (combined) for source and target.
Comment #4
jeffschulerI'm getting these errors
Notice: Undefined offset: 0 in geofield_feeds_combined_source() (line 54 of /sites/all/modules/geofield/geofield.feeds.inc).and
Notice: Use of undefined constant FeedsGeoTermElement - assumed 'FeedsGeoTermElement' in geofield_feeds_combined_source() (line 54 of /sites/all/modules/geofield/geofield.feeds.inc).Maybe:
Comment #5
jeffschulerI just found a need for the lat/long fields that the patch in #1 removes. And re-reading your comment in #2, phayes, I believe you're saying that those fields should remain.
This patch keeps the individual lat, long fields as well as the bounding box fields. I added
geofield_set_target_simple()(same as previousgeofield_set_target()) to cover these. phayes: did you want to maintain geo_type and SRID?The patch also makes the change I suggested in #4 as well as a few minor docs/formatting issues.
Comment #6
batje commentedThis is a real nice patch, especially if you combine it with this pre_save patch
Comment #7
batje commentedchanged the title, as the current patch supports Feeds in General, for example with feeds_jsonpath_parser
Comment #8
Brandonian commentedThanks for the patch, jeffschuler! Patch applied and committed.
Comment #9
levelos commentedJust trying this out as I was working on a similar patch, thanks folks. I'm getting a major bug, though. Using Feeds JSON parser (not really relevant, just FYI), i'm matching a WKT geometry to a WKT target and am getting the following error
Invalid argument supplied for foreach() geofield.feeds.inc:165Why is geofield_set_target_wkt() expecting value to be an array?
Comment #10
levelos commentedHere's a patch that takes care of it, although I'm still not clear why $value would be in array in the first place.
Comment #11
Brandonian commentedThanks for the patch, levelos! I suspect that $value is an array because of how Geofield stores extra metadata with it's values, but I'm not 100% sure, to be honest.
I've committed the patch with minor modifications. Please be sure to change indents from tabs to spaces in your next patch. :-)
Comment #12
levelos commentedThat's great, thanks @Brandonian! Think it's worth digging into why an array was expected? We're doing quite a bit of work on a project importing Geo data into a Geofield using Feeds now and I'd be happy to get it "just right." Re: tabs, that's odd, definitely use spaces in all my editors. Maybe a git diff setting? I'll double check.
BTW - Awesome to see all the work going towards a stable release, thanks!
Comment #13
Brandonian commentedI'm always for actually being able to understand why code acts the way it does, so if you get to it, please share the knowledge.
Comment #14
levelos commentedAssuming you know who authored the initial patch? Can we loop them in? Really wasn't clear to me from reviewing the code so I wouldn't want to make assumptions.
Comment #16
gaëlgIt might be due to a code update, but this is the code that worked for me (no need for a $field array):
Comment #17
Exploratus commentedIw as having issues with D7
I replaced:
WITH