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")
            {

            }

    }
}
  • 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