[Community] PostGIS geometry_columns table question

Sean Gillies sgillies at frii.com
Mon Mar 20 17:06:06 EET 2006


On Mar 20, 2006, at 3:53 AM, CP Hennessy wrote:

> On Sunday 19 March 2006 06:34, larryt at winfirst.com wrote:
>> Hi,
>>
>> I'm a sysadmin and complete GIS noob trying to set up the dublin  
>> forks
>> of Zope3 PCL/ZCO/PrimaGIS for our GIS folks to look at.   
>> Everything is
>> built and working, as far as I can tell without data.  That's where
>> I'm stuck.
>>
>> Where does the PostGIS geometry_columns table come from?  The PostGIS
>> documentation lists its fields, but I can't discover how to populate
>> them.  Is the information in the shape files somewhere?  Our shape
>> file sets include dbf, prj, shp, sbn, prj, shp.xml, sbx and shx  
>> files,
>> but neither ogr2ogr or shp2pgsql created geometry_columns.  Maybe I
>> didn't provide a necessary option?  Few of the documented options
>> meant much to me, not being GIS literate.  Or, maybe geometry_columns
>> has to be built by hand.  If so, are there instructions somewhere  
>> that
>> even a sysadmin could follow?
>
> Hi Larry,
>  The geometry_columns table should be created when you run the sql  
> script
> which comes with postgis.
>
> CPH

Larry,

Here is a slightly modified version of our database creation makefile  
that will smooth out the database creation process:

# --- begin makefile
#  
======================================================================== 
=====
# Python Cartographic Library. Copyright (C) 2005 Sean C. Gillies
#
# This program is free software; you can redistribute it and/or  
modify it
# under the terms of the GNU General Public License as published by  
the Free
# Software Foundation; either version 2 of the License, or (at your  
option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but  
WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY  
or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License  
along with
# this program; if not, write to the Free Software Foundation, Inc.,  
59 Temple
# Place, Suite 330, Boston, MA 02111-1307 USA
#
# Contact email: sgillies at frii.com
#  
======================================================================== 
=====

# Make and populate a PostGIS testing database

# Path to the directory containing the PostGIS setup scripts
# lwpostgis.sql and spatial_ref_sys.sql
POSTGIS = /usr/local/pgsql/share/

# Path to the world borders shapefile. Modify accordingly.
WORLD_BORDERS = ./world_borders.shp

# Name for the new database. The standard testing dbname is pcl_test.
DBNAME = pcl_test

all: testdb

clean:
	dropdb $(DBNAME)

sql:
	shp2pgsql -I -s 4269 $(WORLD_BORDERS) postgis.world_borders > /tmp/ 
wb.sql

testdb: sql
	createdb $(DBNAME)
	createlang plpgsql $(DBNAME)
	psql -d $(DBNAME) -c "CREATE SCHEMA postgis"
	psql -d $(DBNAME) -f $(POSTGIS)/lwpostgis.sql
	psql -d $(DBNAME) -f $(POSTGIS)/spatial_ref_sys.sql
	psql -d $(DBNAME) -f /tmp/wb.sql

# --- end makefile

Or you could use this as a template for running the commands from a  
terminal.

cheers,
Sean

---
Sean Gillies
sgillies   frii com
http://zcologia.com






More information about the Community mailing list