I am working on a web app which uses GeoExt, Geoserver, and PostGIS.

I would like to be able to identify features in this applications using the wms getFeatureInfo and then access a features related records (like photos, documents etc.).

Does anyone know how I could achieve this directly with GeoExt or would I have to venture into PHP or some kind of webservice?

edit - relationship between tables

enter image description here



  • 1
    that would depend on how you have stored the related records. Are they in the postgis table, linked by fid or somewhere else? – Ian Turton Oct 13 '11 at 9:49
  • Yeah the related records are in a PostGIS table. The primary key (gid) of the table containing the features, is the foreign key (featid) in the attachments table. There is a one to many relationship between a feature and attachments. – Ando Oct 13 '11 at 20:52

The simplest way is to create a view with the two tables joined. Make sure that the view is in the Geometry_columns table and GeoServer will serve it up just like any other layer.

Then your WMS GetFeatureInfo request will contain the necessary info for you to display the related items.

| improve this answer | |
  • I'll give it ago and get back to you. However I originally thought that a view would only display a 1 to 1 relationship, so if there were multiple attachments for a point I wont get all related records....never mind I will try and get back to you – Ando Oct 16 '11 at 2:00
  • You should get one row for each joined pair, – Ian Turton Oct 16 '11 at 8:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.