Database Reference
In-Depth Information
• The
CREATE TABLE
section(ifthe
-a
optionisnotselected,inwhichcase,
the table should already exist in the database)
• The
INSERT INTO
section (one
INSERT
statement for each feature to be
imported from the shapefile)
• The
CREATE INDEX
section(if the
-I
option is selected)
Note
Unlike
ogr2ogr
,thereisnowaytomakespatialorattributeselections(
-spat
,
-where ogr2ogr
options) for features in the shapefile to import.
Ontheotherhand,withthe
shp2pgsql
command,itispossibletoimportthem
coordinateofthefeaturestoo(
ogr2ogr
onlysupports
x
,
y
,and
z
atthetimeof
writing).
Tohaveacompletelistofthe
shp2pgsql
commandoptionsandtheirmeaning,just
typethecommandnameintheshell(orinthecommandwindows,ifyouareonWin-
dows) and check the output.
There's more...
If you do not prefer using the command-line utilities, you can still export your
shapefiles, even multiple ones all at once, by using
shp2pgsql-gui
, which is a
GUIsoftwarethatcanalsobeusedasaplugininpgAdmin.Fromitsinterface,you
canselecttheshapefilestoimportinPostGISandselectalltheparametersthatthe
shp2pgsql
commandallowstheusertospecifyasshowninthefollowingscreen-
shot: