Database Reference
In-Depth Information
6. CreateanewPostGIStableforstoringthetopologicaladministrativebound-
aries, as follows:
postgis_cookbook=# CREATE TABLE
chp03.hu_topo_polygons(gid serial primary
key, name_1 varchar(75));
7. Add a topological geometry column to this table using the AddTopoGeo-
metryColumn function:
postgis_cookbook=# SELECT
AddTopoGeometryColumn('hu_topo', 'chp03',
'hu_topo_polygons', 'the_geom_topo',
'MULTIPOLYGON') As layer_id;
8. Insertthepolygonsfromthenontopological hungary spatialtabletotheto-
pological table, using the toTopoGeom function, as follows:
postgis_cookbook=> INSERT INTO
chp03.hu_topo_polygons(name_1,
the_geom_topo)
SELECT name_1, toTopoGeom(the_geom,
'hu_topo', 1)
FROM chp03.hungary;
Query returned successfully: 20 rows
affected, 10598 ms execution time.
9. Now, run the following code to check out how the content of the topology
schemahasbeenmodifiedbythe toTopoGeom function;youwouldexpect
to have 20 faces, one for each Hungarian administrative area; but instead,
there are 97:
postgis_cookbook=# SELECT
topologysummary('hu_topo');
topologysummary
----------------------------------------------------------
Topology hu_topo (1), SRID 3857,
precision 0 +
Search WWH ::




Custom Search