OpenGeo

OpenGeo Stack Workshop

Previous topic

Adding a PostGIS Database to GeoServer

Next topic

Converting Shapefile data to PostGIS

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.

  1. From the Config page navigate to Data ‣ FeatureTypes ‣ New.

  2. Select postgis:::bay_area_roads from drop down list and click New.

    ../_images/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.

  3. On the FeatureType Editor page, change the style by selecting line from the Style drop down list.

    ../_images/gs_table_add2.jpg

    Setting the default style for the bay_area_roads feature type

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

    ../_images/gs_table_add3.jpg

    Generating the bounds of for the bay_area_roads feature type

  5. Scroll to the bottom of the page and click Submit.

  6. Apply and Save changes.

  7. View the new layer from the Map Preview by clicking the topp:bay_area_roads link.

    ../_images/gs_table_add4.jpg

    Selecting the bay_area_roads for map preview

    ../_images/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.

  8. Add the bay_area_transit_routes table repeating steps 1 through 7. Remember to:

    • Set the Style dropdown to line
    • Set the bounds with the Generate button
    • Click Apply after clicking Submit
    ../_images/gs_table_add6.jpg

    Creating the bay_area_transit_routes feature type

    ../_images/gs_table_add7.jpg

    Setting the default style for the bay_area_transit_routes feature type

    ../_images/gs_table_add8.jpg

    Generating the bounds for the bay_area_transit_routes feature type

    ../_images/gs_table_add9.jpg

    The bay_area_transit_routes map preview

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

  10. Verify all feature types are configured properly with the Map Preview.

    ../_images/gs_table_add10.jpg

    Map preview of the bay_area_transit_stations feature type

    ../_images/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.