I'm doing the filtering by passing styles to the server via the WMS request.
I have a style with an else rule that only displays within a certain date
range. I got the default style sheet by serializing the rule using the
OpenLayers SLD.write() method, removing the filter and unnecessary rules.
When I create a WMS layer in OpenLayers, I put a reference to the
stylesheet in the SLD parameter.
var lyrDSPoint = new OpenLayers.Layer.WMS(
"Point",
GeoServerAddress,
{
layers: 'map:POINT',
'SLD': "http://server/Styles/POINT.xml"
},
{
tileOptions: { maxGetUrlLength: 2048 }
}
);
Then when a user wants to filter the layer, I again serialize the style and
pass it in via the SLD_BODY parameter.
var dsStyle = ocStyleMapPoint.styles["default"];
var sld_body = new OpenLayers.Format.SLD().write({
namedLayers: [
{
name: "Point",
userStyles: [dsStyle]
}
]
});
lyrDSPoint.mergeNewParams({ SLD_BODY: sld_body });
There might be other ways of doing it, but this is working very well.
On Sep 23, 2010 1:42am, Justin Deoliveira <[email protected]> wrote:
Hi Rohan,
In short no it is not possible to access the request object or request
parameters from a template. Although it would be possible to hook them up
it take a bit of coding.
About your issue. How exactly are you doing the filtering? Are you using
a filter on the wms request?
-Justin
On Tue, Sep 21, 2010 at 9:51 PM, Rohan Parkes [email protected]>
wrote:
I have an OpenLayers application that uses style rules to only show WMS
data in a layer that matches certain criteria.
However, it has an info tool that uses the OpenLayers WMSGetFeatureInfo
control to get popup information about the layer. This uses the WMS
GetFeatureInfo mode, and the popups are rendered using Freemarker
templates.
The problem is that the info tool returns data for objects that are not
visible. I'd like to be able to only output the template if the data
matches the criteria that were used to filter the layer, whcih I was ging
to pass via the GetFeatureInfo request.
It should technically be possible to read Request parameters in
Freemarker templates, but in Geoserver (2.0.1) it doesn't seem to be
enabled.
I noticed a post about enabling Request parameters here , but I'm not
sure if it's possible to apply these settings in Geoserver.
(I noticed a file dispatcher-servlet.xml under Tomcat webapps, but
attempting to add settings to it was unsuccessful.)
Can anyone tell me if it is possible to read request parameters in
templates under Geoserver?
Rohan Parkes
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users
--
Justin DeoliveiraOpenGeo - http://opengeo.org
Enterprise support for open source geospatial.
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users