[postgis-users] Postgis data loading

strk at refractions.net strk at refractions.net
Thu Apr 7 15:14:29 PDT 2005


On Thu, Apr 07, 2005 at 03:04:01PM -0700, Brent Wood wrote:
> 
> Thanks strk/Marcus,
> 
> My thanks for the new docs, I did just indulge in a bit if rtfm.
> 
> I'm not sure what the "create table" at the end of this section is there for?

It's garbage, my correction was not yet online last time you checked
probably.

> Something I haven't asked before, but kept meaning to, about loading data into
> PostGIS.
> 
> I have found that one of the easiest & most effective way to do this is with
> awk & copy, (at least for point data, or two point linestrings)
> 
> like:
> 
> cat <file> | awk { ... ] | psql $DB -c "copy <table> from stdin ...;"
> 
> where I use awk to take each input line, extract the columns with coords &
> write out the columns I want with a geometry inserted.
> 
> Sticking some tr's & sed in the pipe as well gives a very flexible approach to
> loading data. I have some scripts which use this approach to wget some global
> datasets, create the tables and zcats the downloaded files through such a
> series of pipes to populate the tables.
> 
> There is no mention of copy as a means of loading data in the PostGIS docs
> (section 4.3), just sequences of insert sqls.
> 
> So is there some reason I'm unaware of which makes copy unsuitable, or is it
> just an omission? 

All examples used GeomFromText(), I think to reduce documented "promises".
It came handly when switching between 0.x and 1.x as canonical input
changed between the two.
Anyway, you can read something in 4.1.2.
Actually you can read the whole manual and stop indulging.

--strk;

>  
> 
> Brent
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users



More information about the postgis-users mailing list