[postgis-users] Loading geometrys from csv
Mark Wynter
mark at dimensionaledge.com
Sat May 6 16:32:16 PDT 2017
When you create your table , don't define "the_geom" as a geometry, but rather as text or varchar.
Once loaded, then try
ALTER TABLE your_table ALTER COLUMN the_geom TYPE geometry USING the_geom::geometry;
HTH
Mark
> Message: 1
> Date: Fri, 5 May 2017 20:17:33 -0400
> From: John K <jtkrulick at gmail.com>
> To: postgis-users at lists.osgeo.org
> Subject: [postgis-users] Loading geometrys from csv
> Message-ID:
> <CAHSicSspAapz=u+aEsnB-cmBm-kq3Os4mpX-Bee+s8VTGK7WcA at mail.gmail.com>
> Content-Type: text/plain; charset=UTF-8
>
> Hello,
>
> I have a .csv file with a geometry, and I'm trying to load into a table.
>
> copy public.test FROM '/home/john/test.csv' with (FORMAT csv, DELIMITER E',' )
>
> The csv file has 4 columns and looks like:
> 1,113,31200,\x010600000001000000010300000001000000ba0a00008717...
>
> I'm getting an error:
> ERROR: parse error - invalid geometry
> HINT: "\x" <-- parse error at position 2 within geometry
> CONTEXT: COPY test, line 2, column geom:
> "\x01060000000100000001030000000100000042050000ac1c5a643b4d55c0333674b33f3c40401daa29c93a4d55c0333674..."
>
> Is there anything obvious I'm doing wrong?
>
> Thanks in advance,
> John
More information about the postgis-users
mailing list