Database Reference
In-Depth Information
PG:"dbname='postgis_cookbook' user='me'
password='mypassword'" HUN_adm1.shp
5. After the import process is completed, you can check the count using the
followingcommand;notethatthisspatialtableconsistsof20multipolygons,
each representing one administrative area in Hungary:
postgis_cookbook=# SELECT COUNT(*)
FROM chp03.hungary;
count
-------
20
(1 row)
How to do it...
The steps you need toperform to complete this recipe are asfollows:
1. Allfunctionsandtablesassociatedwiththetopologymoduleareinstalledin
aschemanamed topology ,solet'saddittothesearchpathtoavoidpre-
fixing it before every topology function or object:
postgis_cookbook=# SET search_path TO
chp03, topology, public;
2. Now, you will use the CreateTopology function to create a new topology
schema named hu_topo , in which you will import the 20 administrative
areasfromthe hungary table.InPostGIStopology,allofthetopologyentit-
iesandrelationsneededforonetopologyschemaarestoredinasinglePost-
greSQL schema using the same spatial references system. You will name
this schema hu_topo and use the EPSG:3857 spatial reference (the one
used in the original shapefile):
postgis_cookbook=# SELECT
CreateTopology('hu_topo', 3857);
3. Note how a record has been added to the topology.topology table:
Search WWH ::




Custom Search