Geoserver Tutorial

Publishing your data through GeoServer consists of three steps

  1. Login to the Geoserver
    • Account details will be shared in class
  2. Add a store containing your feature (or raster) datasets and identify the type of the data source you wish to configure
  3. Create a new layer from the data store you configured

A good tutorial illustrating how to add shapefile data to geoserver can be found here.

Adding PostGIS datasets

  1. Login in to the server with username and password. For our tutorial we will use geoserver located at http://geog480.cigi.uiuc.edu:8080/geoserver/
  2. After logging in, click on Stores (in the Data section), then Add new store.
  3. Now in the new DataStore interface. Select 'postgis' from 'Vector Data Sources' section.
    • You should get a new interface that will have various text boxes. The five important options for you to specify are a) Workspace; b) Data Source Name c) database; d) user; e) password. Select your group name as appropriate, from the drop down list for workspace. Give a unique name for the data store. The database name should be the name of that contains the postgis data (e.g. fall14). Then enter your database username and password.
    • Note: hostname should be 'localhost', port should be '5432' and schema should be 'public'. These values should be correctly populated by default and you do not need to change them.
    • Click on Save
    • Now you have created a new datastore that will talk to the postgis database
  4. This will automatically lead to a new layer interface that can be used to add a new feature type.
    • Note you can also reach the new layer page by clicking on layer (on left panel), then “Add a new resource” and selecting your datasource form the drop down menu.
    • You will see the data from the previously added postgis datastore in a list.
    • Click on publish next to the data layer you wish to create.
    • This will lead you to a new interface that will allow you to specify information on this layer.
    • On this page a) Select an appropriate style sheet (in publish tab); b) Click on 'Lookup SRS' button or manually enter the appropriate SRID; c) Click on 'Compute from Data' link which is next to the Bounding Box fields. You should be able to leave other values as defaults; and d) Be sure to mark the layer as enabled (publish tab). Finally Click 'Save' button.
    • Please remember to complete the information on both Data and Publish tab.
    • Your layer from the PostGIS database should now be available as a map, through a WMS interface.
  5. Go to the demo page on the GeoServer (here) and click on the layer you just created.

NOTE: Tutorial on adding a PostGIS table from Geoserver documentation.

Convert a CSV file into a shape file

  /srv/cigi/bin/csv2shp.sh [CSV_input_file] [name_of_column_containing_latitude] [name_of_column_containing_longitude]
  /srv/cigi/bin/csv2shp.sh "/srv/cigi/example/zip_codes_states.csv" "latitude" "longitude"

References



Go back to GEOG 480 Main Page