[postgis-users] Loading geometrys from csv

Regina Obe lr at pcorp.us
Sun May 7 03:17:49 PDT 2017

Oops typo meant:

ALTER TABLE public.test ALTER COLUMN geom TYPE geometry USING ST_GeomFromWKB(geom);

As Mark mentioned (if bytea doesn't work try text for column type).

-----Original Message-----
From: Regina Obe [mailto:lr at pcorp.us] 
Sent: Sunday, May 07, 2017 5:57 AM
To: 'PostGIS Users Discussion' <postgis-users at lists.osgeo.org>
Subject: RE: [postgis-users] Loading geometrys from csv

That looks like WKB format.

What you could try is:

Change your geometry column in public.test to bytea

And then after you are done loading

ALTER TABLE public.test ALTER COLUMN geom TYPE geometry USING ST_GeomFromWB(geom);

-----Original Message-----
From: postgis-users [mailto:postgis-users-bounces at lists.osgeo.org] On Behalf Of John K
Sent: Friday, May 05, 2017 8:18 PM
To: postgis-users at lists.osgeo.org
Subject: [postgis-users] Loading geometrys from csv


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:

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:

Is there anything obvious I'm doing wrong?

Thanks in advance,
postgis-users mailing list
postgis-users at lists.osgeo.org

More information about the postgis-users mailing list