Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Using Feeds 7.x-2.x-dev to import fielded Taxonomy terms, it throws the error on every row:
Cannot construct Point. x and y should be numeric
The only reference I found for this error happens when the latitude/longitude are empty: #1717388: Empty values in Lat/lng and Bounds widgets does not work
but they are present in my case
Recommended version of Feeds 7.x-2.0-alpha8 works fine
Sample Feeds log message (this is not sensitve PI it is from a public data source)
Cannot construct Point. x and y should be numeric
Original item
array(
'name' => 'DeVry University-Arizona',
'description' => '',
'school_alias_data' => 'DeVry University-Mesa |DeVry University-Phoenix |DeVry University-Northeast Phoenix |DeVry University-Glendale',
'school_url_data' => 'http://www.devry.edu',
'school_state_data' => 'AZ',
'school_city_data' => 'Phoenix',
'school_zip_data' => '85021-2995',
'school_address_data' => '2149 W Dunlap Ave',
'school_county_data' => 'Maricopa County',
'school_chief_data' => 'Craig Jacob',
'school_chief_title_data' => 'Metro President',
'school_phone_data' => '6028709222',
'school_admin_url_data' => ' ',
'school_aid_url_data' => ' ',
'school_apply_url_data' => ' ',
'school_latitude_data' => '33.566087',
'school_longitude_data' => '-112.104445',
'school_unitid_data' => '104531',
)
Entity
(object) array(
'vid' => '2',
'vocabulary_machine_name' => 'categories',
'format' => 'plain_text',
'feeds_item' => (object) array(
'is_new' => TRUE,
'entity_id' => 0,
'entity_type' => 'taxonomy_term',
'id' => 'taxonomy_schools_importer',
'feed_nid' => '0',
'imported' => 1392000001,
'hash' => '21ddaa3d1418b7980e9212a20071dd88',
'url' => '',
'guid' => '104531',
),
'name' => 'DeVry University-Arizona',
'field_school_alias_data' => array(
'und' => array(
array(
'value' => 'DeVry University-Mesa |DeVry University-Phoenix |DeVry University-Northeast Phoenix |DeVry University-Glendale',
'format' => 'plain_text',
),
),
),
'description' => '',
'field_school_url_data' => array(
'und' => array(
array(
'value' => 'http://www.devry.edu',
'format' => 'plain_text',
),
),
),
'field_school_address_data' => array(
'und' => array(
array(
'value' => '2149 W Dunlap Ave',
'format' => 'plain_text',
),
),
),
'field_school_city_data' => array(
'und' => array(
array(
'value' => 'Phoenix',
'format' => 'plain_text',
),
),
),
'field_school_state_data' => array(
'und' => array(
array(
'value' => 'AZ',
'format' => 'plain_text',
),
),
),
'field_school_zip_data' => array(
'und' => array(
array(
'value' => '85021-2995',
'format' => 'plain_text',
),
),
),
'field_school_county_data' => array(
'und' => array(
array(
'value' => 'Maricopa County',
'format' => 'plain_text',
),
),
),
'field_school_chief_data' => array(
'und' => array(
array(
'value' => 'Craig Jacob',
'format' => 'plain_text',
),
),
),
'field_school_chief_title_data' => array(
'und' => array(
array(
'value' => 'Metro President',
'format' => 'plain_text',
),
),
),
'field_school_phone_data' => array(
'und' => array(
array(
'value' => '6028709222',
'format' => 'plain_text',
),
),
),
'field_field_school_admin_url_dat' => array(
'und' => array(
array(
'value' => ' ',
'format' => 'plain_text',
),
),
),
'field_field_school_aid_url_data' => array(
'und' => array(
array(
'value' => ' ',
'format' => 'plain_text',
),
),
),
'field_field_school_apply_url_dat' => array(
'und' => array(
array(
'value' => ' ',
'format' => 'plain_text',
),
),
),
'field_school_geofield_data' => array(
'und' => array(
array(
'lat' => array(
'33.566087',
),
'lon' => array(
'-112.104445',
),
),
),
),
'guid' => NULL,
'field_school_unitid_data' => array(
'und' => array(
array(
'value' => '104531',
'format' => 'plain_text',
),
),
),
)
Comment | File | Size | Author |
---|---|---|---|
#22 | geofield-feeds-integration-2192421-22.patch | 611 bytes | robertwb |
#15 | geofield-feeds-integration-2192421-15.patch | 4.22 KB | basvredeling |
#10 | fix-geofield-feeds-2192421-7.patch | 464 bytes | bigssam |
#6 | geofield-feeds-integration-2192421-6.patch | 4.22 KB | olofbokedal |
#2 | geofield-feeds-integration-2192421-2.patch | 4.21 KB | twistor |
Comments
Comment #1
twistor CreditAttribution: twistor commentedLooks like geofield was bitten by #2093651: Simplify target callbacks..
I will roll a patch for this in a moment.
Comment #2
twistor CreditAttribution: twistor commentedThis is the shortest route to being forward and backward compatible.
It looks like this could use some more validation, but that's probably out of scope for this issue.
@decibel.places, I didn't test the patch, if you could be so kind.
Comment #3
decibel.places CreditAttribution: decibel.places commentedalthough Feeds 7.x-2.0-alpha8 works better (imported hundreds of rows) still getting errors
I'll test the patch tomorrow
Comment #4
Yorgg CreditAttribution: Yorgg commentedI had to update geophp to the dev.
Comment #5
Sinovchi CreditAttribution: Sinovchi commentedPatch didn't help when I use Feeds 7.x-2.0-alpha8 or Feeds 7.x-2.x-dev. Updating geophp to the dev also didn't help.
Currently using Feeds 7.x-2.0-alpha7+29-dev (2013-Jan-25) and latest dev of Geofield without any error.
P.S. When I use Feeds 7.x-2.0-alpha8 with attached latest patch I had no errors but it didn't import x,y, coordinates too.
Comment #6
olofbokedal CreditAttribution: olofbokedal commentedChanged the path so that it respects any previous values that has been set.
This works for me, tested using latitude and longitude import.
Comment #7
dobe CreditAttribution: dobe commentedI am not sure if it has to do with this patch or something else. When updating a geofield's lat lon, It does not update it keeps the field as it was. Even though I get no errors and it states that the entity was updated.
When I dpm the $entity within geofield_set_target_simple($source, $entity, $target, $values) it does contain the values it is suppose to be updating to.
** Update ** It was updating nodes correctly. But since I was using another Importer it created new items and they were being updating so no issues from my end on the patch
-Jesse
Comment #8
bigssam CreditAttribution: bigssam commentedthe x, y values are empty because of mallformed values expected (numerci instead of array) by the constructor of Point class.
To fix that issue i use the attached patch il works for me.
Issam.
Comment #9
bigssam CreditAttribution: bigssam commentedComment #10
bigssam CreditAttribution: bigssam commentedthe x, y values are empty because of mallformed values expected (numerci instead of array) by the constructor of Point class.
To fix that issue i use the attached patch il works for me.
Issam.
Comment #11
soraver CreditAttribution: soraver commentedThe patch in #6 works for me, thanks.
Comment #12
1mundus CreditAttribution: 1mundus commented#10 works very well, it was an easy fix. Thank you!
Comment #13
Exploratus CreditAttribution: Exploratus commentedI had this problem when updating to latest dev version of feeds #10 did not work for me, but #6 did. Thanks!
Comment #14
pal4life CreditAttribution: pal4life commentedHi,
I applied the patch in both number 10 and number 6, the issue still persists, its almost driven me to tear my hairs.
I can see the correct values being parsed through and it shows the field has been updated but nothing shows in the point coordinate. Not sure why this is happening?
Also if any once can point to the place where I can debug the exact update query to the database for feeds, I can check that spot what update query is being passed through?
Thanks.
Comment #15
basvredelingTo properly import wkt value the feed importer target should be set to WKT and patch #6 should be changed to the patch below (wkt is actually imported in a array key called 'geom', not 'wkt')...
Comment #16
joelstein CreditAttribution: joelstein commentedThe patch in #6 worked for me, with latest Feeds dev. Thanks!
Comment #17
rjl CreditAttribution: rjl commentedWTK imports are not woking. If I understand basvredeling's patch, it attempts to convert the WTK to an array of values, but that won't work with a Polygon, where the WKT is "Polygon((1 1, 2 2, 3 3, etc))"
I got it to work properly by adding another elseif statement in the same code section where bigssam's patch applies (just before his elseif statement).
elseif (!empty($raw_data['wkt'])) {
$geometry = geoPHP::load($raw_data['wkt']);
}
But not sure if this is the right place to fix it, or if function geofield_set_target_wkt($source, $entity, $target, $value) should be re-worked?
Comment #18
basvredelingClarification of my patch in #15
most important aspects are:
Comment #19
rjl CreditAttribution: rjl commentedbasvredeling, sorry, I am looking at your patch more closely and I was wrong in thinking it was converting to array. I haven't tried your patch, but it looks like it should work fine.
It would be nice if there were more of a sense of what the "$raw_data" variable should be or is intended to be. For example: Is the 'geom' key OK to use for WKT? Is function geofield_set_target_wkt incorrect in assigning a value to a 'wkt' key? Is the 'wkt' key allowed?
Comment #20
basvredeling$raw_data = the unprocessed value from the feeds mapped source, or the unprocessed value stored in the geofield (I believe, the variable name is used ambiguously in geofield.module)
the geofield value, when stored as an array simply doesn't have a 'wkt' key, it does have a 'geom' key, and that is where the wkt value should be stored. so the 'wkt' key is not allowed.
a clear example can be found in code in geofield.formatters.inc lines 265-273
Comment #21
rjl CreditAttribution: rjl commentedbasvredeling, I had a chance finally to apply your patch at #15. At first it didn't work. Looks like the the single quotes used around the 'geom' key came in funny. I changed them to the other style of single quotes used throughout the patch and then it worked fine.
The funny quotes are on line 86 (the 3rd line shown here).
For my purposes, uploading CSV files with a WKT polygon field, the patch works fine (given the quote fix). Thank you!
Comment #22
robertwb CreditAttribution: robertwb commentedThe patch in #15 is right on, but I think that it may not actually be made against the 7.x-2.x-dev branch (or perhaps the branch was changed and this patch was not included)? I get an "Unreversed patch detected!" error and then it fails to apply. Also, as noted by @rjl the quotes come through funny. I have re-applied the code fix outlined in your original to the function geofield_set_target_wkt(), with quotes that don't cause troubles.
The attached patch successfully enabled me to use Feeds Importer to take WKT from an import file and stores it in a field that is stored using the PostGIS backend plugin. This is now ready for further testing if anyone can do so.
Comment #23
robertwb CreditAttribution: robertwb commentedSetting priority to Critical: Critical to establishing a system of regularly updated/synchronized geospatial data sets in Drupal. Feeds importer is a great way to do this. Moreover, this bug broke something that once worked.
Comment #25
Brandonian CreditAttribution: Brandonian commentedThanks for the patch, @robertwb! Committed to 7.x-2.x
http://drupalcode.org/project/geofield.git/commit/5cda7f7
Comment #26
twistor CreditAttribution: twistor commentedThis doesn't address the fact that geofield_set_target_simple() accepts a single value. That will never be the case in later versions of Feeds.
Comment #27
Brandonian CreditAttribution: Brandonian commentedGood to know, @twistor. Any tips on how to address that?
Comment #28
twistor CreditAttribution: twistor commentedThe first part of #2, #6, and #15 have the changes that should work for geofield_set_target_simple().
Comment #30
Brandonian CreditAttribution: Brandonian commentedThank you for the guidance, @twistor. I manually applied the patch in 15 to handle multiple values from Feeds.
http://cgit.drupalcode.org/geofield/commit/?id=400ac26
Comment #31
robertwb CreditAttribution: robertwb commentedThanks @Brandonian for pushing this forward and thanks @Twistor for nailing down the multiple values detail.