I have installed PostgreSQL 9.2 and PostGIS 2.0.3 from Stackbuilder. My template_postgis_20 does not have a geometry table only spatial_ref_sys table.

Is that a problem and, if not, then how can i create table using this postgis template with Geometry?

I have both tried Windows 7 and 8.


There should not be a geometry table so there should be no problem. You will want a table that has a geometry column though. Actually, geometry is the data type, and the column that is of that type can have any name -- the name, however, is conventionally called "geom" or sometimes "the_geom".

You use the template_postgis only when you create a spatial database:

Assuming you're using pgAdmin III,

Object browser > Server Groups > Servers > PostgreSQL (localhost:5432) > Databases 

(From now on, this will be just pgAdmin: >>> Databases)

pgAdmin: >>> Databases R-mouse-btn> New Database

    Name: my_new_db
    Owner: postgres
    Template: template_postgis

That last bit is important; it ensures that the DB is spatially enabled.


Now go examine your new DB.

pgAdmin: >>> Databases > my_new_db > Schemas > public

Notice the counts for the new "empty" DB are all (0), except Functions (approx. 892), Tables (1), Views (4) -- thus, it's spatially enabled.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.