Company logo
  • Empleos
  • Bootcamp
  • Acerca de nosotros
  • Para profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
    • Bootcamp
  • Para empresas
    • Inicio
    • Nuestro proceso
    • Planes
    • Pruebas
    • Nómina
    • Blog
    • Comercial
    • Calculadora

0

295
Vistas
PostgreSQL/PostGIS: shp2pgsql INSERT instead of Creating a new table

Hi I am very new to PostgreSQL/PostGIS and just learned how to convert Shapefiles into SQL file and import it to PostGIS using the shp2pgsql by following this tutorial. What I noticed is that whenever I convert a Shapefile, it generates an SQL file that has a CREATE TABLE statement. Now my question is, is there a way or is it even possible to INSERT a new Shapefile(with new set of layers) into an existing table rather than creating a new one?

I hope I explained it well. Thanks.

9 months ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

You can use append option in your command line. Like this:

.\shp2pgsql.exe -c -I -g "geom" fistShpFile.shp
.\shp2pgsql.exe -a  -g "geom"   nextShpFile.shp
.\shp2pgsql.exe -a  -g "geom"   nextShpFile.shp
...
(-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, default if you do not specify any options. 
-p Prepare mode, only creates the table.

http://www.bostongis.com/pgsql2shp_shp2pgsql_quickguide.bqg

Or use shp2pgsql -? for other options.

9 months ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos