[GIS] shp2pgsql: how to know the schema.table

postgisshapefileshp2pgsql

I want to import a shapefile using shp2pgsql. I am using Mac with Postgis 2.2.

Based on this reference: A conversion and upload can be done all in one step using a UNIX pipe:

  shp2pgsql -s <SRID> -c -D -I <put to shapefile> <schema.<table> | \
  psql -d <databasename> -h <hostname> -U <username>

An example provided in the postgis manual is:

# shp2pgsql shaperoads myschema.roadstable | psql -d roadsdb

Not sure how to find "schema.table". I am working on a shapefile folder which has:

l_2015_us_county yan$ ls
tl_2015_us_county.cpg           tl_2015_us_county.prj           tl_2015_us_county.shp.ea.iso.xml    tl_2015_us_county.shp.xml
tl_2015_us_county.dbf           tl_2015_us_county.shp           tl_2015_us_county.shp.iso.xml       tl_2015_us_county.shx

What is the schema and table in this shapefile?

Best Answer

Schema is something different. Schema is in database, not somewhere with your shapefile. When you created new database, and also extensions by:

CREATE EXTENSION POSTGIS;

You've created new schemas in your database: public and topology. Look at the picture below:

enter image description here

In each of my databases, there are schemas. You can create new schemas, just check the documentation.

http://www.postgresql.org/docs/9.3/static/sql-createschema.html

http://www.tutorialspoint.com/postgresql/postgresql_schema.htm

A schema is a named collection of tables. A schema can also contain views, indexes, sequences, data types, operators, and functions. Schemas are analogous to directories at the operating system level, except that schemas cannot be nested. PostgreSQL statement CREATE SCHEMA creates a schema.
Related Question