GEOSS Banner

Section 4.3.2 Offering data with geoserver

We are going to illustrate in detail and step by step two cases: How to publish a single GeoTIFF image on your GeoServer and How to publish a GeoTIFF mosaic scene on your GeoServer.

GeoServer can be downloaded from http://geoserver.org/display/GEOS/Download. IN this example we are going to use the version 2.1.1.

Before starting, if you do not have the GeoServer set up as a service you need to start it manually. To do so, go to the Start>Programs> GeoServer2.1.1>Start GeoServer. A DOS window will open (and should be kept open) indicating that GeoServer has started and it is running.

Go to the GeoServer Administration link in the Start Menu (GeoServer Web Admin Page) or point your web browser to http://localhost:8080/geoserver. This page is the Web administration interface, which is used to configure all aspects of the GeoServer, and add data to tweaking services settings.

This documentation is directly coming from the GeoServer website (http://docs.geoserver.org)

4.3.2.1 Case 1: How to setup GeoServer

Step 1: GeoServer Installation

Related documentation (for installation on Linux, Mac, or using WAR file):

http://docs.geoserver.org/stable/en/...ion/index.html

System requirements

GeoServer can run either on MS Windows, Linux or Mac OS X.

Some general system requirements for the software to run without problems are listed: Processor: 2 GHz or higher Memory (RAM): 1 GB or higher

Disk Space: 200 MB minimum. However, it is suggested to have a minimum of 1 GB of free disk space. Additional space is required depending on the amount of spatial data that you expect to upload.

Other Software requirements: A Java Runtime Environment (JRE 1.5.0). For server installations, Apache Tomcat can be used instead of Jetty and McKoiDB respectively.

1. Installation

In order to install de GeoServer, firstly the Installation of Java Developement Kit has to be done

Latest version can be found at:

http://www.oracle.com/technetwork/ja...ads/index.html

image48_2.png

1. Select Download Java Platform (JDK) 7

image49_2.png

Here you need to select your file description, that is to say which java you need according to your system (windows x86,…). When the option to download is selected, a new http page will open for you to register:

https://hs-ws1.oracle.com/Registrati...7c22b&tgtVer=7

 

2. Run the executable file you downloaded.

3. Accept the license agreement and click “Next”

4. A “Custom Setup” screen will open, and then all optional features can be selected. 5. Click “Next”.

6. Once the Disable the Public Java Runtime Environment (JRE)


image50.PNG

When your installation is completed click “Finish”.

Registration of your program can be done at:

https://hs-ws1.oracle.com/Registrati...32641&tgtVer=7

 

image51_2.png

Download GeoServer

1. Now we are ready to download GeoServer

Go to the download page and get the latest Stable release:

http://geoserver.org/display/GEOS/GeoServer+2.1.1

image52_2.png

And download the format that best fits you. In our case this will be Windows Installer. It can take some time for the Download to start transferring the geoserver executable

image53_2.png

In our case, download the “Windows Installer”.

2. Run the Installer
1. To run the installer, double click the geoserver executable that has just been downloaded.

 

image54.PNG

Click into the “Next” button.

 

image55.png

Read the GPL license and click I Agree

Choose your install location and click Next, you can leave it in the default directory or change it into another one you prefer.

 

image56.png

3. Choose the name of the Start Menu Folder and click “Next”. Usually this is left to its default value.

 

image57.png

4. Define the path to your JDK install directory by browsing, and click “Next”.

 

image58.png

5. The next window asks where your GeoServer Data Directory is. If this is your first time installing GeoServer, just leave it as Default and click “Next”. If you have a previous version of the GeoServer installed, and you want to use your existing data directory, enter the path to the existing Data Directory. Click “Next”.

 

image59.png

 

 

6. Define user name and Password for an administrator account. You can leave the default values (username: admin, password: geoserver)

image60.png

7. The next window allows you to select the port number on which GeoServer will run. You can leave it as it is (port: 8080).

 

image61.png

8. The following window request us which kind of installation are we going to do. In our case we are going to Run it Manually

 

image62.png

9. Finally, a window Ready to Install opens for you to install the GeoServer

 

image63.png

10. When the installation of GeoServer is completed the following window appears:

 

image64.png

At this point you must have Java DK installed and GeoServer Installed. The Geoserver should be seen as a short cut in your Start Menu.

Step 2. Starting GeoServer

1. Before starting GeoServer, the following environment variables have to be defined: JAVA_HOME and GEOSERVER_HOME. These are the paths to the JDK and GeoServer install directories.

2. You have to go to Start/Settings/Control panel/System, and click the “Advanced” tab. Then click on the “ Environment vaiables” button.

 

image65.png

3. Under “User Variables”, click on New and define your JAVA_HOME variable and then your GEOSERVER_HOME.

 

image66.png

4. Go to Start/Programs/GeoServer 2.1.1/Start GeoServer. A DOS window will open (and stay open) indicating that GeoServer has started.

image67.png

5. After starting up the program, the administrator interface should be available through the GeoServer Administration link in the Start Menu or by pointing your web browser to http://localhost:8080/geoserver/web/

For insights on the Web Administration Interface, please refer to: http://docs.geoserver.org/stable/en/...min/index.html

4.3.2.2 Case 2: Offering a shapefile with geoserver WFS

Step 1: Setup a Shapefile

We are going to publish a coverage that is related to the Arctic layers that we previously used in the definition of the data model section.

First, you have to create a new namespace:

image69.png

We will name it "arctic"

image70.png

Now, we are going to create a data store to include the arctic shape files that we have previously downloaded from the atlas of the cryosphere.

In our case, the idea is to publish the following data:

image71.png

image72.png

Before completing the following form, we have to copy the Shapefiles to the right folder. In our case, the default installation folder is called: C:\Program Files\GeoServer 2.0.1\data_dir\data\shapefiles. Remember that you have to copy at least the *.shp. *.dbf, *.shx, and also the *.prj, when available. In our case, these are the files we copied:

 

image73.png

Now, we are able to fill the remaining fields of the form. In the Connection Parameters URL we introduced the full path and name of the file with .shp extension. After completing the form, we can click on “Save”

 

image74.png

The following screen will appear:

 

image75.png

Press publish and another form will appear to enter the CRS and the bounding boxes.

 

image76.png

Once you press “Save”, you will see:

 

image77.png

In theory, your data is ready to be seen in your WFS service.

Step 2: Test your data

Testing the layer in GeoServer is very simple, because it incorporates tools to do that. In the Layer preview section, it is possible to test the WFS service by selecting the right layer and choosing the right service and format:

image78.png

This way GeoServer generates a WFS request that automatically retrieves the dataset in GML3 format. In our case, it has generated http://localhost:8080/geoserver/ows?...ormat=text/xml; subtype=gml/3.1.1

and we have got the whole polygon dataset as an XML file.

Also, in the Gaia v.3 application we can choose tools|add layer and then select the button with a "plus" symbol. Now we must indicate the name of the service (you can provide any name) and the URL of the GeoServer (by default: http://localhost:8080/geoserver/ows).

 

image79.png

After pressing ok, you will be able to select the cryosphere layer and the version of GML to use.

 

image80.png

and this is the result:

 

image81.png

4.3.2.3 Case 3: Offering a PostGIS table with geoserver WFS

Step 1: Setup a PostGIS data

Create a new data store

The first step is to create a data store for the PostGIS database “nyc”. The data store tells GeoServer how to connect to the database.

1. In a web browser navigate to http://localhost:8080/geoserver.

2. Navigate to Data Stores.

 

image82.png

Adding a New Data Source

3. Create a new data store by clicking the PostGIS link.

4. Keeping the default Workspace enter Basic Store Info of Name and Description.

 

image83.png

Basic Store Info

5. Specify the PostGIS database Connection Parameters

Option

Description

Workspace

Name of the workspace to contain the database. This will also be the prefix of any layer names created from tables in the database.

Data Source Name

Name of the database. This can be different from the name as known to PostgreSQL/PostGIS.

Description

Description of the database/store.

Enabled

Enables the store. If disabled, no data in the database will be served.

dbtype

Type of database. Leave this value as the default.

host

Host name where the database exists.

port

Port number to connect to the above host.

database

Name of the database as known on the host.

schema

Schema in the above database.

user

User name to connect to the database.

passwd

Password associated with the above user.

namespace

Namespace to be associated with the database. This field is altered by changing the workspace name.

max connections

Maximum amount of open connections to the database.

min connections

Minimum number of pooled connections.

fetch size

Number of records read with each interaction with the database.

Connection timeout

Time (in seconds) the connection pool will wait before timing out.

validate connections

Checks the connection is alive before using it.

Loose bbox

Performs only the primary filter on the bounding box. See the section on Using loose bounding box for details.

preparedStatements

Enables prepared statements.

6. Note The username and password parameters specific to the user who created the postgis database. Depending on how PostgreSQL is configured the password parameter may be unnecessary.

 

image84.png

Connection Parameters

7. Click the Save button

Layer Configuration

1. Navigate to Data‣Layers.

2. Select Add a new resource button.

3. From the New Layer chooser drop down menu, select cite:nyc_buidings.

 

image85.png

New Layer drop down selection

On the resulting layer row, select the Layer name nyc_buildings.


 

image86.png

New Layer row

4. The following configurations define the data and publishing parameters for a layer. Enter the Basic Resource Info for nyc_buildings. 


 

image87.png

Basic Resource Info

5. Generate the database bounds by clicking the Compute from data and then Compute from Native bounds. 


 

image88.png

Generate Bounding Box

6. Set the layer’s style by first moving over to the Publishing tab.

7. Then select polygon from the Default Style drop down list.

 

image89.png

Select Default Style

8. Finalize your data and publishing configuration by scrolling to the bottom and clicking Save.

Preview the Layer

9. In order to verify that the nyc_building is published we will preview the layer. Navigate to the Map Preview and search for the cite:nyc_buildings

 

image90.png

Layer Preview

10. Click on the OpenLayers link under the Common Formats column.

Success! An OpenLayers map should load with the default polygon style.

 

image91.png

OpenLayers map of nyc_buildings

Step 2: Test your WFS Service in clients

You can test WFS service in various clients. In our case we will show how to access a WFS Service in uDig (http://udig.refractions.net)

We asume that uDig is installed on the computer.

Getting started

1. After completing the installation, run the uDig application from the Windows Start > Programs menu.

 

image92_2.PNG

2. Initially you are presented with the welcome screen.

3. The welcome screen contains a link to the Getting Started tutorial from the online documentation and a link to the Official Website.

 

image93_2.PNG

4. To continue click on the Workbench arrow in the top right corner of the uDig welcome screen.

5. You are now ready to start to work with uDig.

 

image94_2.PNG

Start uDig, under the File menu select New > New Map to create a new map.

Make sure your local GeoServer is started and ready to go.

Select Layer > Add
image95_2.PNG
This will bring up a Wizard allowing you to choose which Data source you want to use.Select Web Feature Server.

 

image98_2.PNG

This open a window where you have to insert the URL of a web feature server you want to access. In our case type: http://localhost:8080/geoserver/wfs? and click Next.

 

You have now access to all WFS layers available on our GeoServer. Select Manhattan (NY) landmarks and the press the Finish button. The layer will be drawn on your map.

 

image97_2.PNG

Accessing the service

7. Start uDig, under the File menu select New > New Map to create a new map.

8. Make sure your local GeoServer is started and ready to go.

9. Select Layer > Add

10. This will bring up a Wizard allowing you to choose which Data source you want to use.Select Web Feature Server.

 

image95_2.PNG

11. This open a window where you have to insert the URL of a web feature server you want to access. In our case type: http://localhost:8080/geoserver/wfs? and click Next.

 

image98_2.PNG

12. You have now access to all WFS layers available on our GeoServer. Select Manhattan (NY) landmarks and the press the Finish button. The layer will be drawn on your map.

 

image99_2.PNG

4.3.2.4 Step 6: Updating data

In Step 3 we have accessed a WFS layer. Now we can show the editing (transactional) capabilities of a WFS service.

1. Select Navigation > Show All from the menu bar.

11. Zoom to a specific buffer

12. Select Manhattan (NY) landmarks in the Layers view.

13. Choose to the Edit Geometry tool from the tool bar

image100_2.PNG

14. Use the Edit Geometry tool to select a buffer. The buffer will change color and develop “vertex handles”.

15. Move the vertex handles as you want.

16. Once finished, press the Commit Changes button in the tool bar to send your changes off to the Web Feature Server.

image101_2.PNG

Your changes have been registered.

4.3.2.7 Step 7: Optimizing the service performance and maintenance

To optimize service performance various considerations must be taken into account.

An interesting paper discuss these issues: http://opengeo.org/publications/geoserver-production/

Java consideration

http://docs.geoserver.org/stable/en/...tion/java.html

Container consideration

http://docs.geoserver.org/stable/en/...container.html

Configuration consideration http://docs.geoserver.org/stable/en/...on/config.html

Data considerations http://docs.geoserver.org/stable/en/...tion/data.html

Other http://docs.geoserver.org/stable/en/...tion/misc.html

4.3.2.8 Step 8: Service errors and troubleshooting

Please refer to: http://docs.geoserver.org/stable/en/...eshooting.html

4.3.2.9 Step 9: Register the service with GEOSS

This step is related to the CSR tutorial -> make a link to it.



<<Prev T.O.C.  Next>>
Tag
none

Files (0)

 
You must login to post a comment.