[postgis-users] shp2pgsql

pcreso at pcreso.com pcreso at pcreso.com
Thu Dec 10 07:54:18 PST 2009


On a linux platform you can use:

shp2pgsql -a [...] | sed 's/text/klassen/g' | psql -d <database>

under Windows you can run shp2pgsql -a [...] > file.sql

then edit file.sql & do a search/replace on "text" to "klassen"

then run psql -d <database> -f file.sql



Always assuming the word "text" is only ever used as the column name.
If this is not the case, then you will need to edit the file & check each search/replace occurrence.

Or you can use a temporary table (tab2) to insert the data into using shp2pgsql, then in your database run:

insert into tab1 select * from tab2;
drop table tab2; 


HTH,

  Brent Wood

--- On Thu, 12/10/09, MisterX <helpmisterx at googlemail.com> wrote:

> From: MisterX <helpmisterx at googlemail.com>
> Subject: [postgis-users] shp2pgsql
> To: postgis-users at postgis.refractions.net
> Date: Thursday, December 10, 2009, 10:23 PM
> Hi,
> 
> my problem is, that i have a database table with two
> columns with the name klassen ant the_geom. In my shapefile
> the columns called text and the_geom. Now I want to append
> the shapefile on the database table, but how can I tell the
> shapeloader that the column text affiliate to the colum
> klassen?
> 
> shapefile                     database
> Table                        
> --> text                    --> klassen  
> --> the_geom                --> the_geom
>                              
> Can anybody help me with this problem?
> 
> 
> Thank you very much.
> 
> MisterX
> 
> 
> -----Inline Attachment Follows-----
> 
> _______________________________________________
> 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