Saturday, 3 January 2009

Setting up GeoServer

Having got my source data into postGRES I now need to configure GeoServer to deliver the data using WFS.

I installed GeoServer 1.7.1.

First step was to create a namespace:
Config > Data > Namespace > New

Enter prefix: GM
Click new.

Click Submit then Save

The next step is to create the datastore:

Config > Data > DataStores > New

Feature data set description: Postgis
Feature Data Set ID: accidents

Click New then:

Namespace: GM
Description: Road accidents in Greater Manchester
host: localhost
port: 5432
schema: public
database: accidents
user: ****
password: ****

(The username and password are those created when postgreSQL was set up.)

Click Submit you are then prompted to create a featureType:

click create SLD and create feature style settings, e.g. point size and colour

In SRS box enter 27700

click Bounding box Generate button.

click Submit.

Then Apply then Save

To test WFS in uDig go to the GeoServer welcome page and drag WFS Capabilities onto uDig window.

To test in a browser go to:

http://localhost:8080/geoserver/wfs?service=WFS&request=GetCapabilities

The accidents layer appears along with the sample datasets.

To extract a subset of the data using WFS:

http://localhost:8080/geoserver/wfs?service=WFS&request=Getfeature&typeName=GM:accident&CQL_FILTER=ward='CITY%20CENTRE'

This will list all accidents in the CITY CENTRE ward. This, however, does not work in Internet Explorer which returns an error:

The namespace prefix is not allowed to start with the reserved string "xml".

See here for an explanation: http://support.microsoft.com/kb/262585

The problem seems to be with the xml keyword in:

xmlns:xml="http://www.w3.org/XML/1998/namespace"

I will need to investigate how to configure the namespaces in GeoServer (which seems to specify several of them for some reason).

Another problem is that geoServer loses my new featureType each time it is restarted. The namespace and datastore are saved properly but not the featureType which has to be recreated after each restart. The datastore details stored in:

C:\Program Files\GeoServer 1.7.1\data_dir\catalog.xml.

and there is an entry for my datastore.

All the sample featureTypes have folders in:

C:\Program Files\GeoServer 1.7.1\data_dir\ featureTypes\featureTypeName

but nothing is created in here when I create my featureType.

When I select GeoServer Demo > Map preview none of the options work for my data source but those for the demo sources do.

geoServer documentation

Next steps
These two problems (WFS not working in IE and more importantly the issue of not saving the featureType) will need further investigation. However, I am going to put them to one side. I can now extract some data from WFS (using Firefox) which I can save to a text file (GML format). I am now going to experiment with reading in the text file and processing the data using a VB.NET desktop application. My final implementation will involve developing a web application that reads in the data from GeoServer WFS and processing it. But I want to make a start on implementing an algorithm for searching for clusters in the data and I need to simplify the number of steps in the process to do that. If I do it properly the code I develop for the VB.NET desktop application will be easily ported to an ASP.NET application.

Why am I using .NET technologies? So far I have been using open source tools - postgreSQL/postGIS/geoServer and I would like to carry on with this but I don't have the skills for programming open source web applications so I'm going to use .NET.

1 comment:

  1. Hi Nick
    I have had the same problem with the namespace - totally enfuriating!!!

    did you manage to solve your problem - i ahve tried 5 or 6 different name spaces.

    when i get capabilities of my wfs in the xml it says ows: etc, thing is i have seen examples where that should be ogc:

    and i dont know where the ows has come from.

    any help would be great

    Tim

    ps sounds like a great project and great to see another user of OpenSource in the UK

    ReplyDelete