MySQL Forums
Forum List  »  GIS

Bulk insert of geometry types
Posted by: Jeff Storey
Date: September 21, 2010 09:42AM

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?

Options: ReplyQuote


Subject
Views
Written By
Posted
Bulk insert of geometry types
8587
September 21, 2010 09:42AM
3340
October 05, 2010 06:12AM
3243
January 02, 2011 07:20PM
2942
November 05, 2010 09:03AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.