<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Hi Vasile,<br><br> createdb -T [template] [name_of_the_database]<br><br>This creates a new database in a working Postgres instalation.<br><br>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)<br><br>For example just use createdb dbname to create a new database called dbname.<br><br>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]<br><br>You can add Postgis without running  <br>psql -d [database] -f
/usr/share/postgresql/8.4/contrib/spatial_ref_sys.sql<br>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. <br><br>These steps (along with  psql -d [database] -f
/usr/share/postgresql/8.4/contrib/postgis.sql)<br>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.<br><br>The documentation available at www.postgis.org is a good place to start, and various books also provide information on using Postgis, including:<br><br><a href="http://www.amazon.com/Web-Mapping-Illustrated-Source-Toolkits/dp/0596008651/ref=sr_1_1?ie=UTF8&s=books&qid=1271142583&sr=1-1">Web Mapping Illustrated: Using Open Source GIS Toolkits</a> <span class="ptBrand">by <a href="http://www.amazon.com/Tyler-Mitchell/e/B001IXUH7Y/ref=sr_ntt_srch_lnk_1?_encoding=UTF8&qid=1271142583&sr=1-1">Tyler Mitchell</a></span><span class="binding"><br></span><a
 href="http://www.amazon.com/PostGIS-Action-Regina/dp/1935182269/ref=sr_1_2?ie=UTF8&s=books&qid=1271142583&sr=1-2">PostGIS in Action</a> <span class="ptBrand">by Regina and Leo Hsu</span><span class="binding"> (being written)</span><br><div class="productImage"><a href="http://www.amazon.com/Beginning-MapServer-Source-Development-Experts/dp/1590594908/ref=sr_1_3?ie=UTF8&s=books&qid=1271142583&sr=1-3"> </a></div>
<div class="productData">
  
  
  
  <div class="productTitle"><a href="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</a> by Bill Kropla<br><a href="http://www.amazon.com/Desktop-GIS-Mapping-Planet-Source/dp/1934356069/ref=sr_1_6?ie=UTF8&s=books&qid=1271142583&sr=1-6">Desktop GIS: Mapping the Planet with Open Source Tools</a> <span class="ptBrand">by <a href="http://www.amazon.com/Gary-Sherman/e/B002BMKE8I/ref=sr_ntt_srch_lnk_6?_encoding=UTF8&qid=1271142583&sr=1-6">Gary Sherman</a></span><br></div></div><a href="http://www.amazon.com/Approaches-Handling-Advances-Geographic-Information/dp/354074830X/ref=sr_1_9?ie=UTF8&s=books&qid=1271142583&sr=1-9">Open Source Approaches in Spatial Data Handling (Advances in Geographic Information Science)</a> <span class="ptBrand">by Brent Hall and Michael G. Leahy</span><span
 class="binding"></span><br><br>HTH,<br><br>  Brent Wood<br><br>--- On <b>Fri, 4/9/10, Vasile Cristian Stan <i><vasileestan@gmail.com></i></b> wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: Vasile Cristian Stan <vasileestan@gmail.com><br>Subject: [postgis-users] steps in creating a new database<br>To: postgis-users@postgis.refractions.net<br>Date: Friday, April 9, 2010, 10:10 PM<br><br><div id="yiv1748313408">Hi all,<br><br><br>I try to create a new postgis database on Ubuntu, and I'm quite confused about the steps in creating a database.<br><br><br>Creating database:<br># createdb -T [template] [name_of_the_database]<br><br>
- what are the use [-T] and [template] in this line <br>- I can create my own template? for example: # createdb -T [general_data] [world]<br><br>


         
        <title></title>
         
        <style type="text/css">
<!--
 _filtered #yiv1748313408 {margin:0.79in;}
#yiv1748313408 P {margin-bottom:0.08in;}
-->
</style>

<p style="margin-bottom: 0in;">Adding plpsql language to the database:</p><p style="margin-bottom: 0in;">


         
        <title></title>
         
        <style type="text/css">
<!--
 _filtered #yiv1748313408 {margin:0.79in;}
#yiv1748313408 P {margin-bottom:0.08in;}
-->
</style>

</p><p style="margin-bottom: 0in;"># createlang plpgsql [database]</p><p style="margin-bottom: 0in;">


         
        <title></title>
         
        <style type="text/css">
<!--
 _filtered #yiv1748313408 {margin:0.79in;}
#yiv1748313408 P {margin-bottom:0.08in;}
-->
</style>

</p><p style="margin-bottom: 0in;"># psql -d [database] -f
/usr/share/postgresql/8.4/contrib/postgis.sql</p>

<p style="margin-bottom: 0in;"># psql -d [database] -f
/usr/share/postgresql/8.4/contrib/spatial_ref_sys.sql</p>

<p style="margin-bottom: 0in;"># psql -d [database] -c"select
postgis_lib_version();"</p>
<p></p>
<p></p>
<br>- is plpgsql a condition in creating a geodatabase<br>- what's happening if I don't add this line # psql -d [database] -f
/usr/share/postgresql/8.4/contrib/spatial_ref_sys.sql<br><br>- This are the complete steps in creating a spatial database? <br>- Where i can find more information regarding this subject?<br><br><br>Thank you, <br>Cristian<br>
<br>
</div><br>-----Inline Attachment Follows-----<br><br><div class="plainMail">_______________________________________________<br>postgis-users mailing list<br><a ymailto="mailto:postgis-users@postgis.refractions.net" href="/mc/compose?to=postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br><a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br></div></blockquote></td></tr></table>