OpenGeo

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.

    ../_images/gs_table_add1.png

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

    ../_images/gs_table_add2.png

    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.

    ../_images/gs_table_add3.png

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

    Note

    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.

    ../_images/gs_table_add4.png

    Selecting the lnd_oes_view for map preview

    ../_images/gs_table_add5.png

    The lnd_oes_view 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 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.

    ../_images/gs_table_add6.png

    Creating the poi feature type

    ../_images/gs_table_add7.png

    Setting the default style for the poi feature type

    ../_images/gs_table_add8.png

    Setting SRS and bounds for the poi feature type

    ../_images/gs_table_add9.png

    The poi map preview

    Note

    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.