Adding a Postgis layerΒΆ

This task shows how to add a PostGIS layer into GeoServer:

  1. Navigate to the GeoServer Welcome Page.

  2. If you are not already logged in, on the Welcome page locate the Login form located at the top right corner, and enter the username “admin” and password “Geos”.

    ../_images/vector1.png

    GeoServer Login

  3. Click the Add stores link.

    ../_images/vector2.png

    Add stores link

  4. Select the PostGIS link and click it.

    ../_images/postgis_lay1.png

    Add new PostGIS Store

  5. On the New Vector Data Source page fill the following parameter:

    • Data source name, ‘shape’
    • host, ‘localhost’
    • port, ‘5434’
    • database, ‘shape’ the name of the database created in previous workshop step.
    • schema, ‘public’
    • user, ‘geosolutions’ the name of the user database owner.
    • password, ‘Geos’ the user password.

    and click Save.

    ../_images/postgis_lay2.png
    ../_images/postgis_lay2b.png

    Setting database connection parameters

  6. After saving, you will be taken to a page that lists all the layers in the PostGIS database and gives you the option to publish any of them. Click Publish.

    ../_images/postgis_lay4.png

    Publishing a layer from the PostGIS table

  7. The Name and Title fields should be automatically populated. Fill the Declared SRS field to set the Coordinate Reference Systems and generate the bounds for the layer by clicking the Compute from data and Compute from native bounds buttons in the Bounding Boxes section

    ../_images/postgis_lay5.png
    ../_images/postgis_lay6.png

    Populating fields and generating the layer bounding box

  8. Scroll to the bottom of the page, notice the read only Feature Type Detail table and then click Save.

    ../_images/postgis_lay7.png

    Submitting the layer configuration

  9. If all went well, you should see something like this:

    ../_images/postgis_lay8.png

    After a successful save

  10. At this point the PostGIS layer has been added and is ready to be served by GeoServer. Use the layer preview to view its contents, filtering on the ‘main_road’ name.