pgloader question - postgis support

From: Brent Wood <Brent(dot)Wood(at)niwa(dot)co(dot)nz>
To: "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>, "dim(at)tapoueh(dot)org" <dim(at)tapoueh(dot)org>
Subject: pgloader question - postgis support
Date: 2018-06-29 02:33:19
Message-ID: 1530239598882.26532@niwa.co.nz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

I'm looking at pgloader to automate data loading into a Postgis enabled Postgres database.

I have seen in the tutorial how the internal point type is supported, and how the postgis extension can be pre-installed by pgloader if necessary, but I can't see how I might take x & y values & save as a postgis point. I guess I could do this via a trigger, but that is hopefully an unnecessary workaround.

if I read data in (say from CSV):

1,tan0104,1,173.567,-43.678

...

to a Postgis table:

create table station

(id int primary key,

trip char(7)

station_no int,

lon_s decimal(7,4),

lat_s decimal(6,4),

startp geometry(POINT,4326));

the startp column is populated by the SQL:

startp=ST_SetSRID(ST_MakePoint(lon_s,lat_s),4326)

This creates a point feature from the x (lon) & y (lat) coordinates,

and specifies the coordinate reference system as lat/lon degrees WGS84 (EPSG:4326) to match the column specification.

How can I implement that in the pgloader command to load the CSV file?

Thanks

Brent Wood

Programme leader: Environmental Information Delivery
NIWA
DDI: +64 (4) 3860529

Brent Wood
Principal Technician - GIS and Spatial Data Management
Programme Leader - Environmental Information Delivery
+64-4-386-0529 | 301 Evans Bay Parade, Greta Point, Wellington | www.niwa.co.nz<http://www.niwa.co.nz>
[NIWA]<http://www.niwa.co.nz>
To ensure compliance with legal requirements and to maintain cyber security standards, NIWA's IT systems are subject to ongoing monitoring, activity logging and auditing. This monitoring and auditing service may be provided by third parties. Such third parties can access information transmitted to, processed by and stored on NIWA's IT systems.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message TAKATSUKA Haruka 2018-06-29 06:03:10 Windows 10 got stuck with PostgreSQL at starting up. Adding delay lets it avoid.
Previous Message Thomas Munro 2018-06-29 02:02:44 Re: incorrect resource manager data checksum in record