[OpenLayers-Dev] Apply sld_body in a layer SQL View of Geoserver ?
Davi Custódio
Davicustodio at gmail.com
Fri Aug 5 08:25:18 EDT 2011
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/Apply-sld-body-in-a-layer-SQL-View-of-Geoserver-tp6656335p6656335.html
Sent from the OpenLayers Dev mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20110805/9ea6c63e/attachment.html
More information about the Dev
mailing list