[postgis-users] steps in creating a new database

Vasile Cristian Stan vasileestan at gmail.com
Tue Apr 13 01:01:01 PDT 2010


Thank you all, very useful posts.


On Tue, Apr 13, 2010 at 9:14 AM, <pcreso at pcreso.com> wrote:

> Hi Vasile,
>
>
> createdb -T [template] [name_of_the_database]
>
> This creates a new database in a working Postgres instalation.
>
> The -T is an optional parameter allowing you to specify a template database
> to base the new one on. You can create a template database as a custom
> Postgres database with whatever special facilities you may desire to be
> automatically provided in a new database you create, by using it as the
> template. You do not need to use this to create a Postgis database (but you
> can if you so desire)
>
> For example just use createdb dbname to create a new database called
> dbname.
>
> A Postgres database newly created without specifyinfg a suitable custom
> template will not have support for the plpgsql language installed in the
> database. Postgis is basically written in this language, so you need to add
> it to the Postgres database before adding Postgis, using  createlang plpgsql
> [database]
>
> You can add Postgis without running
> psql -d [database] -f /usr/share/postgresql/8.4/contrib/spatial_ref_sys.sql
> but generally I would not. This command creates a table in the Postgis
> database called spatial_ref_sys, which contains information about standard
> projections to enable Postgis to transform (reproject) spatial objects from
> one datum/projection to another.
>
> These steps (along with psql -d [database] -f
> /usr/share/postgresql/8.4/contrib/postgis.sql)
> will create a Postgis, or spatially enabled Postgres database which is
> capable of storing, querying & manipulating spatial objects (geometries),
> but will not create any geometries in the database. You have the facilities
> to manage spatial data, but have not yet added any such data to the new
> database.
>
> The documentation available at www.postgis.org is a good place to start,
> and various books also provide information on using Postgis, including:
>
> Web Mapping Illustrated: Using Open Source GIS Toolkits<http://www.amazon.com/Web-Mapping-Illustrated-Source-Toolkits/dp/0596008651/ref=sr_1_1?ie=UTF8&s=books&qid=1271142583&sr=1-1> by
> Tyler Mitchell<http://www.amazon.com/Tyler-Mitchell/e/B001IXUH7Y/ref=sr_ntt_srch_lnk_1?_encoding=UTF8&qid=1271142583&sr=1-1>
> PostGIS in Action<http://www.amazon.com/PostGIS-Action-Regina/dp/1935182269/ref=sr_1_2?ie=UTF8&s=books&qid=1271142583&sr=1-2> by
> Regina and Leo Hsu (being written)
> <http://www.amazon.com/Beginning-MapServer-Source-Development-Experts/dp/1590594908/ref=sr_1_3?ie=UTF8&s=books&qid=1271142583&sr=1-3>
>  Beginning MapServer: Open Source GIS Development<http://www.amazon.com/Beginning-MapServer-Source-Development-Experts/dp/1590594908/ref=sr_1_3?ie=UTF8&s=books&qid=1271142583&sr=1-3>by Bill Kropla
> Desktop GIS: Mapping the Planet with Open Source Tools<http://www.amazon.com/Desktop-GIS-Mapping-Planet-Source/dp/1934356069/ref=sr_1_6?ie=UTF8&s=books&qid=1271142583&sr=1-6> by
> Gary Sherman<http://www.amazon.com/Gary-Sherman/e/B002BMKE8I/ref=sr_ntt_srch_lnk_6?_encoding=UTF8&qid=1271142583&sr=1-6>
> Open Source Approaches in Spatial Data Handling (Advances in Geographic
> Information Science)<http://www.amazon.com/Approaches-Handling-Advances-Geographic-Information/dp/354074830X/ref=sr_1_9?ie=UTF8&s=books&qid=1271142583&sr=1-9> by
> Brent Hall and Michael G. Leahy
>
> HTH,
>
>   Brent Wood
>
> --- On *Fri, 4/9/10, Vasile Cristian Stan <vasileestan at gmail.com>* wrote:
>
>
> From: Vasile Cristian Stan <vasileestan at gmail.com>
>
> Subject: [postgis-users] steps in creating a new database
> To: postgis-users at postgis.refractions.net
> Date: Friday, April 9, 2010, 10:10 PM
>
>
> Hi all,
>
>
> I try to create a new postgis database on Ubuntu, and I'm quite confused
> about the steps in creating a database.
>
>
> Creating database:
> # createdb -T [template] [name_of_the_database]
>
> - what are the use [-T] and [template] in this line
> - I can create my own template? for example: # createdb -T [general_data]
> [world]
>
> Adding plpsql language to the database:
>
> # createlang plpgsql [database]
>
> # psql -d [database] -f /usr/share/postgresql/8.4/contrib/postgis.sql
>
> # psql -d [database] -f
> /usr/share/postgresql/8.4/contrib/spatial_ref_sys.sql
>
> # psql -d [database] -c"select postgis_lib_version();"
>
>
> - is plpgsql a condition in creating a geodatabase
> - what's happening if I don't add this line # psql -d [database] -f
> /usr/share/postgresql/8.4/contrib/spatial_ref_sys.sql
>
> - This are the complete steps in creating a spatial database?
> - Where i can find more information regarding this subject?
>
>
> Thank you,
> Cristian
>
>
> -----Inline Attachment Follows-----
>
> _______________________________________________
> postgis-users mailing list
>
> postgis-users at postgis.refractions.net<http://mc/compose?to=postgis-users@postgis.refractions.net>
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20100413/39bd6c06/attachment.html>


More information about the postgis-users mailing list