views:

16

answers:

0

I have a mysql database that I'm trying to populate from a text file. The contents of my file look like (as just some examples. there are thousands of rows)

1:GeomFromText('Polygon(0 0, 1 1, 2 2, 0 0)')
2:GeomFromText('Polygon(0 0, 1 2, 2 2, 0 0)')

In my schema, the first field is an integer and the second is GEOMETRY

I try to load the data

LOAD DATA LOCAL INFILE 'myfile.txt' INTO TABLE `testDb`.`testTable` FIELDS TERMINATED BY ':' LINES TERMINATED BY '\n'

And I get the error

Error Code 1416 Cannot get geometry object from data you send to the GEOMETRY field

If I try to do an individual insert like:

INSERT INTO TABLE testTable(id,region) VALUES (1,GeomFromText('Polygon(0 0, 1 1, 2 2, 0 0)'))

It works with no problems. This is very inefficient for a large number of inserts though. Does anyone know why the bulk load is throwing that error?

thanks, Jeff