1

I'm creating a application with Geoserver, OpenLayers and Postgis. At some point, the user can select his own style for a layer. I've succeded to make a php script to write to a file the SLD code. Dynamic style for each user based on Postgis attributes. The problem is that when I select to add the style, nothing happens. The SLD is working fine. I've tested it on Geoserver - view layers. But in my application it doesn't do anything. here is my code for mergeing the SLD external file:

  function layerselect(layer)
    {

        value_selected = document.getElementById("legend_option").value;

        if(value_selected=="Pret/mp")
            {
            spatii.mergeNewParams({SLD: "file:///C:/Program Files (x86)/EasyPHP-Webserver-14.1b2/www/data_dir/www/proprietati/tmpo/ro25858_spatii_pretmp.sld"});

            }
        if(value_selected=="2")
            {

            }

    }
}

closed as off-topic by Ian Turton Feb 15 '16 at 8:39

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This problem cannot or can no longer be reproduced. Changes to the system or to the asker's circumstances may have rendered the question obsolete, or the question does not include a procedure to enable potential answerers to reproduce the same symptoms. Such questions are off-topic as they are unlikely to help future readers, but editing them to include more details can lead to re-opening." – Ian Turton
If this question can be reworded to fit the rules in the help center, please edit the question.

  • Did you get the name right? Please add your sld file – Ian Turton Feb 14 '16 at 19:53
  • I found the error. It was from the fwrite php code - it was writing to other file. Not from the source of SLD code. But, for others who will have this problem. First, in the sld code, you must put the layer name in NamedLayer. Also, in the mergenewparams: {SLD: LINK} you can put your link 127.0.0.1:8080/sldfile And set STYLE to null ! {SLD: "link_to_sld", STYLES: null} thank you – Sasu Andrei Feb 14 '16 at 20:32