Hello, 

The Geoserver version 2.1 onwards, provides support to so called Layers SQL
View, where you can create SQL statements with parameters pointing to a
PostGIS (for example). Using OpenLayers, wms can create dynamic layers from
a sql command using the parameter viewparams. Example: 

var wms = new OpenLayers.Layer.WMS.Post ("Test View", "/ GeoServer / wms",
{layers: 'censoibge: test', format: 'image / gif', transparent: "true",
style: style }, options); 

var str = "(culture = 'Soja' and year = 2009 and area_plantada>
area_plantada 100 and <= 1000 and area_plantada <> 0) or"; 
   str + = "(culture = 'Soja' and year = 2009 and area_plantada>
area_plantada 1000 and <= 2000) or"; 
   str + = "(culture = 'Soja' and year = 2009 and area_plantada>
area_plantada 2000 and <= 3000) or"; 
   str + = "(culture = 'Soja' and year = 2009 and area_plantada>
area_plantada 3000 and <= 4000) or"; 
   str + = "(culture = 'Soja' and year = 2009 and area_plantada>
area_plantada 4000 and <= 5000) or"; 
   str + = "(culture = 'Soja' and year = 2009 and area_plantada>
area_plantada 5000 and <= 10000) or"; 
   str + = "(culture = 'Soja' and year = 2009 and area_plantada> 10000)"; 
    
wms.mergeNewParams ({ 
viewparams "sql: select * from where vw_pam_all_shapes" + str 
  }); 

The problem is when I try to set a sld_body to implement different styles
for each condition. Testing sld_body in a normal layer (not SQL type VIEW)
everything works ok, but if I do: 

wms.mergeNewParams ({ 
sld_body: sld 
}); 

the layer styles and does not respect the rules defined in SLD. 

Can anyone help? There is the possibility of applying layers sld_body in the
sql view Geoserver? If not, there is another alternative that allows the
flexibility to open the setting styles for the user? 

Thank you.

--
View this message in context: 
http://osgeo-org.1803224.n2.nabble.com/Geoserver-SQL-View-Layers-SLD-BODY-tp6666737p6666737.html
Sent from the GeoServer - Dev mailing list archive at Nabble.com.

------------------------------------------------------------------------------
uberSVN's rich system and user administration capabilities and model 
configuration take the hassle out of deploying and managing Subversion and 
the tools developers use with it. Learn more about uberSVN and get a free 
download at:  http://p.sf.net/sfu/wandisco-dev2dev
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Reply via email to