1

I have trouble coloring the polygons in my layer based on the values in a certain field in another table in my postgresql database that is different from the attribute table of the layer itself. Is there any way to do this ?

note : I am working on a decision support system that is using a key performance indicator ( KPI ) that is being calculated by means of a stored procedure and the result is received in a separate table from which I need to color my original layer that is visible to the user.

1- I am using zend framework

2- I use openlayers to render the maps from geoserver

3- My layers are published using geoserver from postgis database and I would like to use another separate table in the postgresql database in order to style one of the published layers I think it can be done with table joins but the problem is openlayers makes layer styling by calling certain functions that deals with geoserver directly so, how can I solve this problem ?

  • Please edit your question and share what you have got so far? – Farid Cheraghi Jun 20 '15 at 13:48
  • I editted the question with more info – Muhammad Gamal Jun 27 '15 at 22:30
1

If I understand correctly you should be able to do a table join then simply assign a color in your polygon styling.

function drawPolygon(feature, olmap, hexFillColor, opacity) {

    var selected_polygon_style = {
        strokeWidth: 1,
        fillColor: hexFillColor,
        fillOpacity: opacity,
    }
    feature.style = selected_polygon_style;

    return feature;
}

In this instance I'm getting feature information from an ajax call then drawing and styling.

  • what if the join will slow down the system horribly ?? – Muhammad Gamal Jul 24 '15 at 21:44

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.