.. _geoserver.postgis.gs_table_add:

Adding a PostGIS Table to GeoServer
-----------------------------------

In this section the PostGIS tables created in previous sections will be published as GeoServer feature types using skills learned in previous modules.

#. From the `Config page <http://localhost:8080/geoserver/config/index.do>`_ navigate to :menuselection:`Data --> FeatureTypes --> New`.

#. Select :guilabel:`postgis:::bay_area_roads` from drop down list and click :guilabel:`New`.

   .. figure:: gs_table_add1.jpg

      Creating the bay_area_roads feature type

   .. note::  The drop down list contains a list of the tables which are available to be published. When a table is chosen from the list a new Feature Type is created from it.

#. On the :guilabel:`FeatureType Editor` page, change the style by selecting :guilabel:`line` from the :guilabel:`Style` drop down list.

   .. figure:: gs_table_add2.jpg

      Setting the default style for the bay_area_roads feature type

#. Generate the bounds for the layer by clicking **Generate** located on the middle of the page.

   .. figure:: gs_table_add3.jpg

      Generating the bounds of for the bay_area_roads feature type

#. Scroll to the bottom of the page and click :guilabel:`Submit`.

#. :guilabel:`Apply` and :guilabel:`Save` changes.

#. View the new layer from the `Map Preview <http://localhost:8080/geoserver/mapPreview.do>`_ by clicking the **topp:bay_area_roads** link.

   .. figure:: gs_table_add4.jpg

      Selecting the bay_area_roads for map preview

   .. figure:: gs_table_add5.jpg

      The bay_area_roads map preview

   .. warning:: Is the map *blank*? A common problem is that the default style is not set properly. Double check the style on the layer.

#. Add the :guilabel:`bay_area_transit_routes` table repeating steps 1 through 7. Remember to:

   * Set the :guilabel:`Style` dropdown to :guilabel:`line`
   * Set the bounds with the :guilabel:`Generate` button
   * Click :guilabel:`Apply` after clicking :guilabel:`Submit`

   .. figure:: gs_table_add6.jpg

      Creating the bay_area_transit_routes feature type

   .. figure:: gs_table_add7.jpg

      Setting the default style for the bay_area_transit_routes feature type

   .. figure:: gs_table_add8.jpg

      Generating the bounds for the bay_area_transit_routes feature type
      
   .. figure:: gs_table_add9.jpg

      The bay_area_transit_routes map preview

#. Add the :guilabel:`bay_area_transit_stations`, and :guilabel:`bay_area_bus_stops` tables repeating steps 1 through 7. Set the default style to :guilabel:`point` for the feature types.

#. Verify all feature types are configured properly with the `Map Preview <http://localhost:8080/geoserver/mapPreview.do>`_.

   .. figure:: gs_table_add10.jpg

      Map preview of the bay_area_transit_stations feature type

   .. figure:: gs_table_add11.jpg

      Map preview of the bay_area_bus_stops feature type

At this point GeoServer is publishing all the data in the PostGIS database. The next few modules will focus on styling this data.
