.. _geoserver.postgis.db_create:

Creating a Spatial Database
---------------------------

In previous sections a PostGIS was installed and is now ready for us. In this section a new PostGIS database will be created using the PostgreSQL administration console pgAdmin.

#. Open the **PostgresSQL Administration Console** by opening the :guilabel:`Start Menu` and navigating to :menuselection:`Programs --> PostgreSQL 8.2 --> pgAdmin III`.

   .. figure:: db_create1.jpg

      Running the PostgreSQL adminstration console, pgAdmin

#. In **pgAdmin** connect to the database by right-clicking on :guilabel:`PostgreSQL Database Server 8.2 (localhost:5432)` and selecting :guilabel:`Connect`.

   .. figure:: db_create2.jpg

      Connecting to the database with pgAdmin

#. In the :guilabel:`Connect To Server` dialog, enter the password "postgres", check off :guilabel:`Store Password`, and click :guilabel:`OK`.

   .. figure:: db_create3.jpg

      Specifying the database password

#. In the :guilabel:`Object Browser` right-click on :guilabel:`Databases` and select :guilabel:`New Database...`

   .. figure:: db_create4.jpg

      Creating a new database

#. In the :guilabel:`New Database...` dialog: 
  
   #. Enter "bayarea" in the :guilabel:`Name` field
   
   #. Select :guilabel:`UTF8` from the :guilabel:`Encoding` drop down list
 
   #. Select :guilabel:`template_postgis` from the :guilabel:`Template` drop down list
  
   #. Click :guilabel:`OK`

   .. figure:: db_create5.jpg

      Creating a PostGIS database 

At this point a new PostGIS database has been created and is ready for use. In the :ref:`next <geoserver.postgis.postgis_load>` section the new database will be loaded with data.
