[postgis-users] Import TIN via SQL COPY from file

Hillier, Michael Michael.Hillier at NRCan-RNCan.gc.ca
Thu Jun 4 12:53:13 PDT 2015


Hello,



I am trying to import a TIN surface into postgresql + postgis database from a file via an SQL COPY command.



First off, here is my table:



CREATE TABLE tintable(id int4 primary key, geom geometry(TIN,4326));



Because the TIN data is too large (thousands of entries) I can not use the  command

INSERT INTO tintable (id,geom) VALUES (1,ST_GeomFromText('TIN(((1 0,0 1,1 1,1 0)))',4326));



So I use the following:



COPY tintable FROM 'C::\\users\\...' DELIMITERS '|'



I have tried the following formats in the file I am trying to copy from:



1|(0 0,0 1,1 1,0 0) -> ERROR:  parse error - invalid geometry HINT:  "(0" <-- parse error at position 2 within geometry



1|0 0,0 1,1 1,0 0 -> ERROR:  Invalid hex string, length (15) has to be a multiple of two! CONTEXT:  COPY tintable, line 1, column geom: "0 0,0 1,1 1,0 0"



1|((0 0,0 1,1 1,0 0)) -> ERROR:  parse error - invalid geometry HINT:  "((" <-- parse error at position 2 within geometry



What is the correct file format so I can import TIN data using the command "COPY tintable FROM 'C::\\users\\...' DELIMITERS '|' "?



Thank you


More information about the postgis-users mailing list