OpenLayers: moving points auto update via Geoserver/PostGIS possible ?

I try to implement a fleet tracking application with PostGIS, Geoserver, Openlayers Addon and Vaadin.

Selecting the displayed vessels, applying temporal filters, getting detailed info by clicking vessels on the map etc. should be done with Vaadin.

GPS positions are written to Postgres/PostGIS DB, a Geoserver runs a PostGIS Layer on this. This runs so far.

Another layer gives me a map. Combining the two layers in e.g. Qantum GIS works. Refreshing the display manually updates the

GPS points as they have entered the database.

Consuming the two layers via WMS with pure Javascript OpenLayers (before trying with the Vaadin addon) works also - but static:

Refreshing the browser does not refresh the GPS positions when the DB changes.

Maybe the browser has no clue the page has invalidated and still delivers the cached version.

After a lot of googling I also tried things like

var refreshStrategy = new OpenLayers.Strategy.Refresh({interval: 3000,force: true});

Still no update. Even pure JavaScript OpenLayers seems to have its problems here. I could imagine some Ajaxian / Websocket stuff, but don’t find examples.

Now I’m not sure how all this updating stuff from DB to Vaadin UI can work. I do not know the implications of the add-on wrapping approach to things like refreshes.

Even pure JavaScript OpenLayers seems to have its problems here.

What strategy would you recommend to get a clean, robust architecture for a Vaadin approach on auto-updating layers ?



I’d definitely not use WMS to display anything highly dynamic, such as moving vessels. That is not optimal neither for client nor your map server. WMS is good for background layers.

Don’t know details about your architecture, but I’d assume you can easily access vessel points from you UI/Vaadin server. Best would be to hook directly to your service that receives GPS data, but at least you could access to data with an http request (WFS) to your GeoServer. Then I’d just draw vessels with PointVector, VectorLayer and some styling. Check this demo where
a separate thread updates a vector
. Your code would most likely look much more cleaner and simpler, but fundamental idea would be the same. This also makes it much easier to do other UI interactions with vessels with e.g. VectorSelectedListener.


Hi Matti,

sorry for the delay. Thanks for your thoughts. I see what you mean with perfomance issues and will check on this. I was happy that setting up WMS queries was so easy, but I will learn how WFS works.

I had seen that vector example you mentionend and was somewhat reluctant about handling all objects in a discrete way. So much code.

Minimum coding overrides performance in my initiative, as me and involved colleagues don’t have very deep programming experience.

The example .js i found at would

resemble what i coul imagine as an elegant architecture with minimum coding. Implementing all selections with filters by time, space or even status of an object and controlling the filter settings with Vaadin UI elements.

The mentioned example puts the points also on a vector layer, getting it from a static array. Here i wanted to plug in a query to a Geoserver which is connected to a PostGIS DB which is directly fed with GPS fixes via a Apache Camel connector.

The routing and storing of GPS data is mandatory, the rest of the arcitecture is completely open. I just want to decouple the GUI stuff from the whole GIS things, coming to the

sketeched layout. Pulling details (measuring data) from a selected object on the map of course would mean a direct SQL fetch out of Vaadin, probably not PostGIS, maybe some NoSQL DB.

Implementing all this with Javascript seems to be clear, but as there will be serverside business logic for sure, Vaadin is the more clever solution.

Does this all make sense to you ?