Database Reference
In-Depth Information
hyd_type text,
geom_type text,
the_geom geometry
);
Ifyouarepayingattention,youwillnotethatwealsoaddeda geometry fieldasall
ofourshapefilesimplicitlyhavethiscommonality.Toestablishinheritanceforagiven
table,weneedtodeclareonlytheadditionalfieldsthatthechildtablecontains,using
the following query:
CREATE TABLE chp02.hydrology_centerlines (
"length" numeric
) INHERITS (chp02.hydrology);
CREATE TABLE chp02.hydrology_polygon (
area numeric,
perimeter numeric
) INHERITS (chp02.hydrology);
CREATE TABLE chp02.hydrology_linestring (
sinuosity numeric
) INHERITS (chp02.hydrology_centerlines);
Now we are ready to load our data using the following commands:
shp2pgsql -s 3734 -a -i -I -W LATIN1 -g the_geom
cuyahoga_hydro_polygon chp02.hydrology_polygon | psql -U
me -d postgis_cookbook
shp2pgsql -s 3734 -a -i -I -W LATIN1 -g the_geom
cuyahoga_hydro_polyline
chp02.hydrology_linestring
|
psql -U me -d postgis_cookbook
shp2pgsql -s 3734 -a -i -I -W LATIN1 -g the_geom
cuyahoga_river_centerlines chp02.hydrology_centerlines |
psql -U me -d postgis_cookbook
Ifweviewourparenttable,wewillseealltherecordsinallthechildtables.Aviewing
of any of the child tables will just reveal the specific table of interest.
Search WWH ::




Custom Search