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'm new to GIS applications and trying to figure out what options I have for visualizing spatial query results that combine raster and vector data using OpenLayers/GeoExt/GeoServer/PostGIS.

A hypothetical query that could be created on a web client by a user might be: "give me all raster pixels with an index value of 1 that are within a distance of 120 meters of any river (line vector feature) and touching or inside a selected watershed (polygon vector feature)".

I think I have a good idea how I could write a where clause for a spatial SQL query such this, but it's not at all clear where I'm submitting this type of query from my Javascript web client. Some PHP examples I've found seem to suggest that a server side process will have to submit the SQL query, presumably directly to the PostGIS database? Is this correct?

It's also not super clear how I can visualize mixed raster/vector query results. I've seen some purely vector examples that create a Vector map layer in open layers and when the vector features come back to the client, those features are simply pushed onto the Vector map layer. Assuming a mixed vector+raster query is possible in PostGIS, should I be expecting to follow the same process (get vector features back, then add them to a Vector OpenLayers layer) for visualization?

Lastly, does it even sound like I'm thinking along the right lines here or am I attempting to do something that is difficult or even impossible given the feature sets available in Open Source GIS tools these days? Thanks in advance for any advice or direction

share|improve this question
add comment

1 Answer 1

To answer just one part of the question, specifically

I think I have a good idea how I could write a where clause for a spatial SQL query such this, but it's not at all clear where I'm submitting this type of query from my Javascript web client. Some PHP examples I've found seem to suggest that a server side process will have to submit the SQL query, presumably directly to the PostGIS database? Is this correct?

Yes, you need to have some server side scripting to access your database, and you have to be very careful that you don't open your application to SQL injection type security vulnerabilities. I would recommend using prepared statements for accessing your DB layer.

See http://en.wikipedia.org/wiki/Prepared_statement for more information.

share|improve this answer
    
Definitely, keeping SQL injection in mind is a good point. Still struggling to piece together the big picture, though. Overall, Raster+Vector query functionality seems pretty limited in most spatial databases, including PostGIS. Hoping someone can prove me wrong, though. Cheers! –  JDischler Apr 30 '13 at 16:35
add comment

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.