This appears to be related to the issue described in #1344958: Feeds import failing on "Feeds import failing on".

I am importing from a file using the xpath parser. When tags for latitude and longitude are missing or contain 0, 0 I get the same error reported in that issue

SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column 'field_location_lid' at row 1

Comments

doubouil’s picture

I somehow fixed it using Feeds JSONPath Parser with Feeds tamper (warning, need a quick patch for last version of Feeds, see this issue)

Mapping should allow you to use xpath parser instead of JSONPath since the trick is to rewrite the values and populate the coords target instead of each latitude & longitude target.

You have to had two temporary targets mapped to your source latitude & longitude. Then, map an xpath or JSONPath expression to the coordinates target.

Using Tamper, add 3 operations :
- Copy source value from the temp target latitude to the mapped expression field
- Copy source value from the temp target longitude to the mapped expression field
- Add an implode with a comma on the resulting feed

I only used the location name and coordinates mapping (I don't need province or city fields), and my empty values are created perfectly.

mikel1’s picture

Thanks doubouil for the suggestion. Since I create the feed, rather than use feeds_tamper, I just packed the lat. ad long. into a field with a , in between. No luck for me. FWIW here is a dump of the field just before the return in location_feeds_set_target().

    [field_location] => Array
        (
            [und] => Array
                (
                    [0] => Array
                        (
                            [location_settings] => Array
                                (
                                    [form] => Array
                                        (
                                            [fields] => Array
                                                (
                                                    [name] => Array
                                                        (
                                                            [collect] => 0
                                                            [default] => 
                                                            [weight] => 2
                                                        )

                                                    [street] => Array
                                                        (
                                                            [collect] => 0
                                                            [default] => 
                                                            [weight] => 4
                                                        )

                                                    [additional] => Array
                                                        (
                                                            [collect] => 0
                                                            [default] => 
                                                            [weight] => 6
                                                        )

                                                    [city] => Array
                                                        (
                                                            [collect] => 1
                                                            [default] => 
                                                            [weight] => 8
                                                        )

                                                    [province] => Array
                                                        (
                                                            [collect] => 1
                                                            [widget] => select
                                                            [default] => 
                                                            [weight] => 10
                                                        )

                                                    [postal_code] => Array
                                                        (
                                                            [collect] => 1
                                                            [default] => 
                                                            [weight] => 12
                                                        )

                                                    [country] => Array
                                                        (
                                                            [collect] => 1
                                                            [default] => us
                                                            [weight] => 14
                                                        )

                                                    [locpick] => Array
                                                        (
                                                            [collect] => 1
                                                            [weight] => 20
                                                        )

                                                )

                                        )

                                    [display] => Array
                                        (
                                            [hide] => Array
                                                (
                                                    [name] => name
                                                    [street] => street
                                                    [additional] => additional
                                                    [city] => 0
                                                    [province] => 0
                                                    [postal_code] => 0
                                                    [country] => 0
                                                    [locpick] => 0
                                                    [province_name] => 0
                                                    [country_name] => 0
                                                    [map_link] => 0
                                                    [coords] => 0
                                                )

                                        )

                                )

                            [coords] => 41.85,-87.65
                        )

                )

        )