Multiple adjacent shape file and postGIS?

Stephen Woodbridge woodbri at SWOODBRIDGE.COM
Wed Nov 28 00:17:54 EST 2007


kreshna_iceheart at yahoo.com wrote:
> Er, I hope I'm not asking the wrong question here.
> 
> I'm about to try MapServer with postGIS spatial
> database. I have tried converting SHP file to postGIS
> table using this guide:
> http://www.bostongis.com/?content_name=postgis_tut01
> 
> And it was quite successful.
> 
> However, my real data is multiple adjacent SHPs. When
> using SHP files for Map Server, I can use tile
> indexing. But now I'm going to use postGIS table.
> 
> So the question is: how can I convert all those
> adjacent shape files to a postGIS table? Is there any
> 'append' feature that I haven't been aware of?
> 
> Many thanks,
> -Kresh

For the first file in a table use -c and then for all the rest use -a read:

woodbri at carto:~/dev$ shp2pgsql
RCSID: $Id: shp2pgsql.c,v 1.106 2006/01/16 10:42:58 strk Exp $
USAGE: shp2pgsql [<options>] <shapefile> [<schema>.]<table>

OPTIONS:
   -s <srid>  Set the SRID field. If not specified it defaults to -1.

   (-d|a|c|p) These are mutually exclusive options:
       -d  Drops the table , then recreates it and populates
           it with current shape file data.
       -a  Appends shape file into current table, must be
           exactly the same table schema.
       -c  Creates a new table and populates it, this is the
           default if you do not specify any options.
       -p  Prepare mode, only creates the table

   -g <geometry_column> Specify the name of the geometry column
      (mostly useful in append mode).

   -D  Use postgresql dump format (defaults to sql insert
       statments.

   -k  Keep postgresql identifiers case.

   -i  Use int4 type for all integer dbf fields.

   -I  Create a GiST index on the geometry column.

   -w  Use wkt format (for postgis-0.x support - drops M - drifts 
coordinates).

   -W <encoding> Specify the character encoding of Shape's
      attribute column. (default : "ASCII")

   -N <policy> Specify NULL geometries handling policy (insert,skip,abort)



More information about the mapserver-users mailing list