[postgis-devel] Re: PostGIS datastore creation

Mark Cave-Ayland mark.cave-ayland at ilande.co.uk
Wed Sep 20 04:24:32 PDT 2006


On Tue, 2006-09-19 at 13:42 -0700, Paul Ramsey wrote:
> We appear to have slowed down on this discussion, so to pick up the 
> thread, in public this time:
> 
> - The PostGIS FDO datastore has an interesting requirement. From a 
> client-side, it needs the ability to create a new spatially-enabled 
> database.
> - This is not so wierd. It is possible to create a new ordinary database 
> just using the "CREATE DATABASE" command, assuming you have sufficient 
> privilege.
> - But to create a spatially enabled database, you have to also source 
> some SQL files on the server machine, and that is not something you can 
> do without logging into the machine itself. So as a pure database 
> client, it is NOT POSSIBLE.
> - The workaround to this would be to have a standard spatially-enabled 
> TEMPLATE available in the server install, a "template_gis", if you will.
> - If we made this template part of our standard install process on 
> Windows, and added a "make install_template" directive in our UNIX 
> build, I think we could begin a migration to ensuring that this 
> capability was generally available by the time the PostGIS FDO provider 
> was in wide use.
> - This would also be useful for any other client framework.  In fact, 
> the Debian packaging already has this concept hanging around somewhere.
> 
> Thoughts?
> 
> Paul


Hi Paul,

Maybe another option would be create a small C program called
"postgis_install" that could do the install for you. For example:

	postgis_install [-h host] [-p port] [-U user] -f lwpostgis.sql

The program could work something like this:

	- Check for the existence of the template_gis database. If it
	doesn't exist, connect to the template1/postgres database,
	issue CREATE DATABASE template_gis and disconnect.

	- Connect to the template_gis database and simply read in all
	commands from the file specified by -f (this would also work
	for loading spatial_ref_sys.sql into the template_gis database).

Since the program is written in C, it would work across all platforms
and would also have the advantage of being able to install on both
remote and local servers. It would also mean the installation
instructions would be consistent across all platforms, rather than
having different sets of instructions for Win32/Unix-based OS.


Kind regards,

Mark.





More information about the postgis-devel mailing list