Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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

Thanks

Ando

share|improve this question
1  
that would depend on how you have stored the related records. Are they in the postgis table, linked by fid or somewhere else? –  iant 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

1 Answer 1

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.

share|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, –  iant Oct 16 '11 at 8:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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