0

My sld is not applying

function cusMap(strSld_body,talukaName,name){
console.log(strSld_body);
var query = new OpenLayers.Layer.WMS.Post(name,
        geoServerURL, {
            LAYERS : 'VP:village_customize',
            sld_body : strSld_body,
            format : 'image/jpeg',
            transparent : 'true'
        },
        {
            unsupportedBrowsers: [],
            isBaseLayer: false,
            yx : {'EPSG:4326' : true}
        } );
      query.mergeNewParams({'CQL_FILTER': "Taluka='"+talukaName+"'"});
      query.mergeNewParams({'sld_body': strSld_body});
      query=registerEvents(query);
map.addLayer(query);

}

The sld I am applying is as below

 <?xml version="1.0" encoding="UTF-8"?><StyledLayerDescriptor xmlns="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.1.0/StyledLayerDescriptor.xsd" xmlns:se="http://www.opengis.net/se">
  <NamedLayer><se:Name>Village</se:Name><UserStyle><se:Name>Village</se:Name><se:FeatureTypeStyle><se:Rule><se:Name>5 - 121</se:Name><se:Description><se:Title>5 - 121</se:Title></se:Description><ogc:Filter xmlns:ogc="http://www.opengis.net/ogc"><ogc:Or><ogc:PropertyIsEqualTo><ogc:PropertyName>Village</ogc:PropertyName><ogc:Literal>Satsan</ogc:Literal></ogc:PropertyIsEqualTo><ogc:PropertyIsEqualTo><ogc:PropertyName>Village</ogc:PropertyName><ogc:Literal>Arkhi</ogc:Literal></ogc:PropertyIsEqualTo><ogc:PropertyIsEqualTo><ogc:PropertyName>Village</ogc:PropertyName><ogc:Literal>Vadvas</ogc:Literal></ogc:PropertyIsEqualTo><ogc:PropertyIsEqualTo><ogc:PropertyName>Village</ogc:PropertyName><ogc:Literal>Lakhanasar</ogc:Literal></ogc:PropertyIsEqualTo><ogc:PropertyIsEqualTo><ogc:PropertyName>Village</ogc:PropertyName><ogc:Literal>Mahudi Moti</ogc:Literal></ogc:PropertyIsEqualTo><ogc:PropertyIsEqualTo><ogc:PropertyName>Village</ogc:PropertyName><ogc:Literal>Mahudi Nani</ogc:Literal></ogc:PropertyIsEqualTo><ogc:PropertyIsEqualTo><ogc:PropertyName>Village</ogc:PropertyName><ogc:Literal>Rampura Mahudi</ogc:Literal></ogc:PropertyIsEqualTo><ogc:PropertyIsEqualTo><ogc:PropertyName>Village</ogc:PropertyName><ogc:Literal>Kotda (Jegol)</ogc:Literal></ogc:PropertyIsEqualTo><ogc:PropertyIsEqualTo><ogc:PropertyName>Village</ogc:PropertyName><ogc:Literal>Rajkot</ogc:Literal></ogc:PropertyIsEqualTo><ogc:PropertyIsEqualTo><ogc:PropertyName>Village</ogc:PropertyName><ogc:Literal>Bhilachal</ogc:Literal></ogc:PropertyIsEqualTo><ogc:PropertyIsEqualTo><ogc:PropertyName>Village</ogc:PropertyName><ogc:Literal>Vavdhara</ogc:Literal></ogc:PropertyIsEqualTo><ogc:PropertyIsEqualTo><ogc:PropertyName>Village</ogc:PropertyName><ogc:Literal>Hariyawada</ogc:Literal></ogc:PropertyIsEqualTo><ogc:PropertyIsEqualTo><ogc:PropertyName>Village</ogc:PropertyName><ogc:Literal>Jegol</ogc:Literal></ogc:PropertyIsEqualTo><ogc:PropertyIsEqualTo><ogc:PropertyName>Village</ogc:PropertyName><ogc:Literal>Atal</ogc:Literal></ogc:PropertyIsEqualTo><ogc:PropertyIsEqualTo><ogc:PropertyName>Village</ogc:PropertyName><ogc:Literal>Bhakodar</ogc:Literal></ogc:PropertyIsEqualTo><ogc:PropertyIsEqualTo><ogc:PropertyName>Village</ogc:PropertyName><ogc:Literal>Dhaneri</ogc:Literal></ogc:PropertyIsEqualTo><ogc:PropertyIsEqualTo><ogc:PropertyName>Village</ogc:PropertyName><ogc:Literal>Velavas</ogc:Literal></ogc:PropertyIsEqualTo><ogc:PropertyIsEqualTo><ogc:PropertyName>Village</ogc:PropertyName><ogc:Literal>Malpuriya</ogc:Literal></ogc:PropertyIsEqualTo><ogc:PropertyIsEqualTo><ogc:PropertyName>Village</ogc:PropertyName><ogc:Literal>Ranol</ogc:Literal></ogc:PropertyIsEqualTo><ogc:PropertyIsEqualTo><ogc:PropertyName>Village</ogc:PropertyName><ogc:Literal>Chodungri</ogc:Literal></ogc:PropertyIsEqualTo><ogc:PropertyIsEqualTo><ogc:PropertyName>Village</ogc:PropertyName><ogc:Literal>Bhadli Kotha</ogc:Literal></ogc:PropertyIsEqualTo><ogc:PropertyIsEqualTo><ogc:PropertyName>Village</ogc:PropertyName><ogc:Literal>Nandotra (Brahmanvas</ogc:Literal></ogc:PropertyIsEqualTo><ogc:PropertyIsEqualTo><ogc:PropertyName>Village</ogc:PropertyName><ogc:Literal>Jorapura (Lodpa)</ogc:Literal></ogc:PropertyIsEqualTo><ogc:PropertyIsEqualTo><ogc:PropertyName>Village</ogc:PropertyName><ogc:Literal>Nilpur</ogc:Literal></ogc:PropertyIsEqualTo><ogc:PropertyIsEqualTo><ogc:PropertyName>Village</ogc:PropertyName><ogc:Literal>Nandotra (Thakorvas)</ogc:Literal></ogc:PropertyIsEqualTo><ogc:PropertyIsEqualTo><ogc:PropertyName>Village</ogc:PropertyName><ogc:Literal>Sikariya</ogc:Literal></ogc:PropertyIsEqualTo><ogc:PropertyIsEqualTo><ogc:PropertyName>Village</ogc:PropertyName><ogc:Literal>Bhakhar Moti</ogc:Literal></ogc:PropertyIsEqualTo><ogc:PropertyIsEqualTo><ogc:PropertyName>Village</ogc:PropertyName><ogc:Literal>Lodpa</ogc:Literal></ogc:PropertyIsEqualTo><ogc:PropertyIsEqualTo><ogc:PropertyName>Village</ogc:PropertyName><ogc:Literal>Ramsida (Chhapra)</ogc:Literal></ogc:PropertyIsEqualTo></ogc:Or></ogc:Filter><se:PolygonSymbolizer><se:Fill><se:SvgParameter name="fill">#ccffcc</se:SvgParameter></se:Fill><se:Stroke><se:SvgParameter name="stroke">#000000</se:SvgParameter><se:SvgParameter name="stroke-width">0.26</se:SvgParameter><se:SvgParameter name="stroke-linejoin">bevel</se:SvgParameter></se:Stroke></se:PolygonSymbolizer></se:Rule><se:Rule><se:Name>122 - 238</se:Name><se:Description><se:Title>122 - 238</se:Title></se:Description><ogc:Filter xmlns:ogc="http://www.opengis.net/ogc"><ogc:Or><ogc:PropertyIsEqualTo><ogc:PropertyName>Village</ogc:PropertyName><ogc:Literal>Vagor</ogc:Literal></ogc:PropertyIsEqualTo><ogc:PropertyIsEqualTo><ogc:PropertyName>Village</ogc:PropertyName><ogc:Literal>Zat</ogc:Literal></ogc:PropertyIsEqualTo><ogc:PropertyIsEqualTo><ogc:PropertyName>Village</ogc:PropertyName><ogc:Literal>Bhandotra</ogc:Literal></ogc:PropertyIsEqualTo><ogc:PropertyIsEqualTo><ogc:PropertyName>Village</ogc:PropertyName><ogc:Literal>Dantiwada</ogc:Literal></ogc:PropertyIsEqualTo><ogc:PropertyIsEqualTo><ogc:PropertyName>Village</ogc:PropertyName><ogc:Literal>Akoli</ogc:Literal></ogc:PropertyIsEqualTo><ogc:PropertyIsEqualTo><ogc:PropertyName>Village</ogc:PropertyName><ogc:Literal>Ganguwada</ogc:Literal></ogc:PropertyIsEqualTo><ogc:PropertyIsEqualTo><ogc:PropertyName>Village</ogc:PropertyName><ogc:Literal>Bhadali (Zat)</ogc:Literal></ogc:PropertyIsEqualTo><ogc:PropertyIsEqualTo><ogc:PropertyName>Village</ogc:PropertyName><ogc:Literal>Gangudara</ogc:Literal></ogc:PropertyIsEqualTo><ogc:PropertyIsEqualTo><ogc:PropertyName>Village</ogc:PropertyName><ogc:Literal>Deri</ogc:Literal></ogc:PropertyIsEqualTo><ogc:PropertyIsEqualTo><ogc:PropertyName>Village</ogc:PropertyName><ogc:Literal>Odhava</ogc:Literal></ogc:PropertyIsEqualTo><ogc:PropertyIsEqualTo><ogc:PropertyName>Village</ogc:PropertyName><ogc:Literal>Shergadh Odhava</ogc:Literal></ogc:PropertyIsEqualTo><ogc:PropertyIsEqualTo><ogc:PropertyName>Village</ogc:PropertyName><ogc:Literal>Ratanpur</ogc:Literal></ogc:PropertyIsEqualTo><ogc:PropertyIsEqualTo><ogc:PropertyName>Village</ogc:PropertyName><ogc:Literal>Godh</ogc:Literal></ogc:PropertyIsEqualTo><ogc:PropertyIsEqualTo><ogc:PropertyName>Village</ogc:PropertyName><ogc:Literal>Bhakhar Nani</ogc:Literal></ogc:PropertyIsEqualTo><ogc:PropertyIsEqualTo><ogc:PropertyName>Village</ogc:PropertyName><ogc:Literal>Vaghrol</ogc:Literal></ogc:PropertyIsEqualTo><ogc:PropertyIsEqualTo><ogc:PropertyName>Village</ogc:PropertyName><ogc:Literal>Dangiya</ogc:Literal></ogc:PropertyIsEqualTo></ogc:Or></ogc:Filter><se:PolygonSymbolizer><se:Fill><se:SvgParameter name="fill">#b3ffb3</se:SvgParameter></se:Fill><se:Stroke><se:SvgParameter name="stroke">#000000</se:SvgParameter><se:SvgParameter name="stroke-width">0.26</se:SvgParameter><se:SvgParameter name="stroke-linejoin">bevel</se:SvgParameter></se:Stroke></se:PolygonSymbolizer></se:Rule><se:Rule><se:Name>239 - 355</se:Name><se:Description><se:Title>239 - 355</se:Title></se:Description><ogc:Filter xmlns:ogc="http://www.opengis.net/ogc"><ogc:Or><ogc:PropertyIsEqualTo><ogc:PropertyName>Village</ogc:PropertyName><ogc:Literal>Dhaniyawada</ogc:Literal></ogc:PropertyIsEqualTo><ogc:PropertyIsEqualTo><ogc:PropertyName>Village</ogc:PropertyName><ogc:Literal>Gundari</ogc:Literal></ogc:PropertyIsEqualTo></ogc:Or></ogc:Filter><se:PolygonSymbolizer><se:Fill><se:SvgParameter name="fill">#99ff99</se:SvgParameter></se:Fill><se:Stroke><se:SvgParameter name="stroke">#000000</se:SvgParameter><se:SvgParameter name="stroke-width">0.26</se:SvgParameter><se:SvgParameter name="stroke-linejoin">bevel</se:SvgParameter></se:Stroke></se:PolygonSymbolizer></se:Rule><se:Rule><se:Name>356 - 472</se:Name><se:Description><se:Title>356 - 472</se:Title></se:Description><ogc:Filter xmlns:ogc="http://www.opengis.net/ogc"><ogc:PropertyIsEqualTo><ogc:PropertyName>Village</ogc:PropertyName><ogc:Literal>Bhilada</ogc:Literal></ogc:PropertyIsEqualTo></ogc:Filter><se:PolygonSymbolizer><se:Fill><se:SvgParameter name="fill">#66ff66</se:SvgParameter></se:Fill><se:Stroke><se:SvgParameter name="stroke">#000000</se:SvgParameter><se:SvgParameter name="stroke-width">0.26</se:SvgParameter><se:SvgParameter name="stroke-linejoin">bevel</se:SvgParameter></se:Stroke></se:PolygonSymbolizer></se:Rule><se:Rule><se:Name>473 - 589</se:Name><se:Description><se:Title>473 - 589</se:Title></se:Description><se:PolygonSymbolizer><se:Fill><se:SvgParameter name="fill">#33ff33</se:SvgParameter></se:Fill><se:Stroke><se:SvgParameter name="stroke">#000000</se:SvgParameter><se:SvgParameter name="stroke-width">0.26</se:SvgParameter><se:SvgParameter name="stroke-linejoin">bevel</se:SvgParameter></se:Stroke></se:PolygonSymbolizer></se:Rule><se:Rule><se:Name>590 - 706</se:Name><se:Description><se:Title>590 - 706</se:Title></se:Description><se:PolygonSymbolizer><se:Fill><se:SvgParameter name="fill">#00ff00</se:SvgParameter></se:Fill><se:Stroke><se:SvgParameter name="stroke">#000000</se:SvgParameter><se:SvgParameter name="stroke-width">0.26</se:SvgParameter><se:SvgParameter name="stroke-linejoin">bevel</se:SvgParameter></se:Stroke></se:PolygonSymbolizer></se:Rule><se:Rule><se:Name>707 - 823</se:Name><se:Description><se:Title>707 - 823</se:Title></se:Description><ogc:Filter xmlns:ogc="http://www.opengis.net/ogc"><ogc:PropertyIsEqualTo><ogc:PropertyName>Village</ogc:PropertyName><ogc:Literal>Panthawada</ogc:Literal></ogc:PropertyIsEqualTo></ogc:Filter><se:PolygonSymbolizer><se:Fill><se:SvgParameter name="fill">#00cc00</se:SvgParameter></se:Fill><se:Stroke><se:SvgParameter name="stroke">#000000</se:SvgParameter><se:SvgParameter name="stroke-width">0.26</se:SvgParameter><se:SvgParameter name="stroke-linejoin">bevel</se:SvgParameter></se:Stroke></se:PolygonSymbolizer></se:Rule></se:FeatureTypeStyle></UserStyle></NamedLayer></StyledLayerDescriptor>

The sld is not showing any error in geoserver but layer is not taking passed sld to render.

The sld is applying which is default in geoserver not that one which I am passing. Can anyone help me to get out of this?

  • 2
    Try making the name in the layer query match the NamedLayer in the SLD. That is, replace <se:Name>Village</se:Name> with <se:Name>VP:village_customize</se:Name> – BradHards Dec 17 '15 at 6:39
  • But Legend is not coming in Ext JS. How can i force to show legend? – Mr. P Dec 17 '15 at 10:20
  • I think that is a completely separate question. – BradHards Dec 17 '15 at 10:25
  • Here is link to new question gis.stackexchange.com/questions/174237/… – Mr. P Dec 17 '15 at 10:54
1

That is, replace

<se:Name>Village</se:Name> with <se:Name>VP:village_customize</se:Name> in SLD.

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.