[postgis-users] Loading multiple shapefiles with different schemas into the same PostGIS layer

Stefan Keller sfkeller at gmail.com
Sat Oct 18 17:10:29 PDT 2008


If table structures (and even formats) are different and you want to
automate it without programming, I would recommend an upcoming ETL
tool called GeoKettle from Univ. Laval, Canada:
http://tinyurl.com/43w5en

-- Stefan

2008/10/17 Todd Fagin <tfagin at coordinatesolutions.com>:
> Greetings PostGIS-ers,
>
>
>
> I have another newbie question for you.
>
>
>
> I have multiple shapefiles I want to load into PostGIS as a single layer.
> However, these shapefiles have different schemas.  I know that shp2pgsql has
> the -a option for appending  However, the tables must have the same schema,
> right?
>
>
>
> I have come up with a convoluted way to do this and it works.  However, I
> have feeling that someone much smarter than I has already found a more
> elegant solution to this.
>
>
>
> Here is what I have done:
>
>
>
> 1. Convert each shapefile to SQL using shp2pgsql; this is especially
> important since it creates the the_geom field
>
> 2. Run the SQL script for the shapefile that has the schema I will use
>
> 3. Edit the remaining .sql files generated for each shapefile by shp2pgsql,
> removing everything but the INSERT statements and editing the fields to map
> to the appropriate fields in the existing table (this is the part that could
> be cumbersome, hence looking for a more elegant solution).
>
> 4. Run the edited SQL scripts for each of the remaining shapefiles.
>
>
>
> Thanks,
>
>
>
> Todd
>
>
>
> Todd Fagin
>
>
>
> Coordinate Solutions, Inc.
>
> 2804 NW 18th St.
>
> Oklahoma City, OK 73107
>
> 405.740.4324 (voice)
>
> 904.471.5548 (fax)
>
> www.coordinatesolutions.com
>
>
>
>
>
>
>
> _______________________________________________
> 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