Web-GIS with GeoServer and GeoExt

Previous topic

Adding a MySQL Database to GeoServer

Next topic

Styling with SLD

Adding a MySQL Table to GeoServer

In this section the MySQL 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 imak09_gNN:::lnd_oes_view from drop down list and click New.


    Creating the lnd_oes_view feature type


    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 polygon from the Style drop down list.


    Setting the default style for the lnd_oes_view feature type

  4. Enter “31287” in the SRS field and generate the bounds for the layer by clicking Generate located on the middle of the page.


    Projection (SRS) and bounds of for the lnd_oes_view feature type


    MySQL does not know about spatial reference systems (SRS). It is up to you to provide the correct EPSG code for the stored coordinates.

  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 imak09_gNN:lnd_oes_view link.


    Selecting the lnd_oes_view for map preview


    The lnd_oes_view map preview


    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 poi table repeating steps 1 through 7, with a few differences:

    • Set the Style dropdown to point
    • Set the SRS to “4326”
    • Because the poi layer is meant to add features to it, set the bounds so it covers all of Austria, by setting * :guilabel: Min Long: “9”, :guilabel: Min Lat: “46.5” * :guilabel: Max Long: “17.5”, :guilabel: Max Lat: “49” Do not click Generate

    Remember to click Apply and Save after clicking Submit.


    Creating the poi feature type


    Setting the default style for the poi feature type


    Setting SRS and bounds for the poi feature type


    The poi map preview


    The Map Preview offeres more different formats than just the OpenLayers preview. If you have Google Earth installed, you can e.g. try the KML preview, which will open Google Earth and show the layer there.

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