Geography Reference
In-Depth Information
$
psql gis_data
Welcome to psql 8.2.4, the PostgreSQL interactive terminal.
Type:
\copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit
gis_data=
# \d parklands
Table "public.parklands"
Column | Type | Modifiers
----------+-----------------------+-----------
id | integer | not null
name | character varying(10) |
the_geom | geometry
|
Indexes:
"parklands_pkey" PRIMARY KEY, btree (id)
"sidx_parklands" gist (the_geom)
Check constraints:
"enforce_dims_the_geom" CHECK (ndims(the_geom) = 2)
"enforce_geotype_the_geom" CHECK (geometrytype(the_geom) =
'POLYGON'::text OR the_geom IS NULL)
"enforce_srid_the_geom" CHECK (srid(the_geom) = 4326)
We use the
\d
command to list the properties of the
parklands
table.
Notice under the indexes heading there is a primary key on the
id
field
and, under that, a GiST index on the geometry column
the_geom
. If you
don't see an entry for a GiST index in the list, you should create one
for your table. To create a GiST index for your table, use the following
SQL:
CREATE INDEX sidx_parklands on parklands USING GIST (the_geom GIST_GEOMETRY_OPS);
If you import shapefiles using SPIT, a GiST index will not be created.
Using
shp2pgsql
allows you specify the creation of a GiST index during
page
203
for an example.
Loading PostGIS Data
There are a number of ways to load data into a PostGIS-enabled data-
see how to load data using both the OGR and PostGIS command-line
utilities. For now we'll look at two other methods for loading data: SQL
and QGIS.
Search WWH ::
Custom Search