[OpenLayers-Users] Fw: HELP!!! How implement Filter in WMS Layer

fsalas fsalas at geocuba.cu
Tue Sep 15 11:09:10 EDT 2009


Andreas I followed his suggestion step by step, but don't work I attach one image with my maps.

as you can see i have defined base layer and overlays layers.

I don't now  why when I put in my IE URL work fine?

http://urano:3128/geoserver/wms?bbox=%20-86.09240990784447,%2019.463031059956343,-72.99589832490545,%2023.6349399434799280&Format=image/png&request=GetMap&width=800&height=250&srs=EPSG:4267&SLD_BODY=%3CStyledLayerDescriptor%20version%3D%221.0.0%22%3E%3CUserLayer%3E%3CName%3Etopp:sennal%3C/Name%3E%3CUserStyle%3E%3CName%3EUserSelection%3C/Name%3E%3CFeatureTypeStyle%3E%3CRule%3E%3CFilter%20xmlns:gml%3D%22http://www.opengis.net/gml%22%3E%3CPropertyIsEqualTo%3E%3CPropertyName%3Etipo%3C/PropertyName%3E%3CLiteral%3EFV%3C/Literal%3E%3C/PropertyIsEqualTo%3E%3C/Filter%3E%3CPointSymbolizer%3E%3CGraphic%3E%3CExternalGraphic%3E%3COnlineResource%20xmlns:xlink=%22http://www.w3.org/1999/xlink%22%20xlink:type=%22simple%22%20xlink:href=%22file:/D:/AppServ/www/SIGANAV/images/FV.gif%22/%3E%3CFormat%3Eimage/gif%3C/Format%3E%3C/ExternalGraphic%3E%3COpacity%3E%3CLiteral%3E1.0%3C/Literal%3E%3C/Opacity%3E%3CSize%3E%3CLiteral%3E20.0%3C/Literal%3E%3C/Size%3E%3CRotation%3E%3CLiteral%3E0.0%3C/Literal%3E%3C/Rotation%3E%3C/Graphic%3E%3C/PointSymbolizer%3E%3C/Rule%3E%3C/FeatureTypeStyle%3E%3C/UserStyle%3E%3C/UserLayer%3E%3C/StyledLayerDescriptor%3E


However in my  Sennales = new OpenLayers.Layer.WMS(
  "Señales","http://urano:3128/geoserver/wms",
  {
  layers:'topp:sennal',
 sld_body:
*
*
*
*
dont't work.

Why??????

Regards , Salas









----- Original Message ----- 
From: "Andreas Hocevar" <ahocevar at opengeo.org>
To: "fsalas" <fsalas at geocuba.cu>
Cc: <users at openlayers.org>
Sent: Monday, September 14, 2009 1:32 PM
Subject: Re: [OpenLayers-Users] HELP!!! How implement Filter in WMS Layer


Hi,

see my suggestions inline.

fsalas wrote:
> thank you Andeas for your help, but I continue with some problems and
> maybe you can be help me again.
>
>    I do it this and nothing
>
>            var bounds = new OpenLayers.Bounds(
>                -85.49711392680179, 19.65266328193469,
>                -73.59119430594814, 23.44530772150158
>            );
>
>            var options = {
>                controls: [],
>                maxExtent: bounds,
>                maxResolution: 0.04650749851895958,
>                projection: "EPSG:4267",
>                units: 'degrees'
>            };
>
>            map = new OpenLayers.Map('map', options);
>
>
>
>             Batimetria = new OpenLayers.Layer.WMS(
>                "Batimetría","http://urano:3128/geoserver/wms",
>                {
>                     layers: 'topp:batimetria'
>                }
>            );
>
>
>           Cuba = new OpenLayers.Layer.WMS(
>             "Cuba","http://urano:3128/geoserver/wms",
>             {
>                   layers: 'topp:cuba',
>                   srs: 'EPSG:4267',

Remove the srs. You have set it on the map already.
>                  styles: 'line',
>                   transparent: 'true',
>                  format: 'image/png'
>             },
>             {
>                 buffer: 0
>              }
>            );
>
>
>  Sennales = new OpenLayers.Layer.WMS(
>  "Señales","http://urano:3128/geoserver/wms",
>  {
>  layers:'topp:sennal',
> sld_body:'%3CStyledLayerDescriptor%20version%3D%221.0.0%22%3E%3CUserLayer%3E%3CName%3Etopp:sennal%3C/Name%3E%3CUserStyle%3E%3CName%3EUserSelection%3C/Name%3E%3CFeatureTypeStyle%3E%3CRule%3E%3CFilter%20xmlns:gml%3D%22http://www.opengis.net/gml%22%3E%3CPropertyIsEqualTo%3E%3CPropertyName%3Etipo%3C/PropertyName%3E%3CLiteral%3EFV%3C/Literal%3E%3C/PropertyIsEqualTo%3E%3C/Filter%3E%3CPointSymbolizer%3E%3CGraphic%3E%3CExternalGraphic%3E%3COnlineResource%20xmlns:xlink=%22http://www.w3.org/1999/xlink%22%20xlink:type=%22simple%22%20xlink:href=%22file:/D:/AppServ/www/SIGANAV/images/FV.gif%22/%3E%3CFormat%3Eimage/gif%3C/Format%3E%3C/ExternalGraphic%3E%3COpacity%3E%3CLiteral%3E1.0%3C/Literal%3E%3C/Opacity%3E%3CSize%3E%3CLiteral%3E20.0%3C/Literal%3E%3C/Size%3E%3CRotation%3E%3CLiteral%3E0.0%3C/Literal%3E%3C/Rotation%3E%3C/Graphic%3E%3C/PointSymbolizer%3E%3C/Rule%3E%3C/FeatureTypeStyle%3E%3C/UserStyle%3E%3C/UserLayer%3E%3C/StyledLayerDescriptor%3E',
>
>  srs:'EPSG:4267',

Remove the srs
>  height:'557',
>  width:'800',
Remove height and width, these are handled by OpenLayers.

>  transparent:'true',
>         format: 'image/png',
>  }

All your layers are configured as base layers, so I bet you only see the
Batimetria layer. Make the layer an overlay by adding

, {isBaseLayer: false}

> );
>
>  map.addLayers([Batimetria,Cuba,Sennales]);
>
> ---------------------------------------------------------------------------------------
>
>
> I do it this and nothing
>
> function CHANGE_SLD_BODY()
> {
>
> var new_sld_body =
> '%3CStyledLayerDescriptor%20version%3D%221.0.0%22%3E%3CUserLayer%3E%3CName%3Etopp:sennal%3C/Name%3E%3CUserStyle%3E%3CName%3EUserSelection%3C/Name%3E%3CFeatureTypeStyle%3E%3CRule%3E%3CFilter%20xmlns:gml%3D%22http://www.opengis.net/gml%22%3E%3CPropertyIsEqualTo%3E%3CPropertyName%3Etipo%3C/PropertyName%3E%3CLiteral%3EFV%3C/Literal%3E%3C/PropertyIsEqualTo%3E%3C/Filter%3E%3CPointSymbolizer%3E%3CGraphic%3E%3CExternalGraphic%3E%3COnlineResource%20xmlns:xlink=%22http://www.w3.org/1999/xlink%22%20xlink:type=%22simple%22%20xlink:href=%22file:/D:/AppServ/www/SIGANAV/images/FV.gif%22/%3E%3CFormat%3Eimage/gif%3C/Format%3E%3C/ExternalGraphic%3E%3COpacity%3E%3CLiteral%3E1.0%3C/Literal%3E%3C/Opacity%3E%3CSize%3E%3CLiteral%3E20.0%3C/Literal%3E%3C/Size%3E%3CRotation%3E%3CLiteral%3E0.0%3C/Literal%3E%3C/Rotation%3E%3C/Graphic%3E%3C/PointSymbolizer%3E%3C/Rule%3E%3C/FeatureTypeStyle%3E%3C/UserStyle%3E%3C/UserLayer%3E%3C/StyledLayerDescriptor%3E';
>
>
>  map.layers[2].mergeNewParams({sld_body : new_sld_body });
>   map.layers[2].redraw();

Remove the redraw() line. mergeNewParams will take care of that.

> }
>
>
> ---------------------------------------------------------------------------------
>
>
>
> however I do it this and is working fine!
>
>
> http://localhost:3128/geoserver/wms?bbox= -86.09240990784447,
> 19.463031059956343,-72.99589832490545,
> 23.6349399434799280&Format=image/png&request=GetMap&width=800&height=250&srs=EPSG:4267&SLD_BODY=%3CStyledLayerDescriptor%20version%3D%221.0.0%22%3E%3CUserLayer%3E%3CName%3Etopp:sennal%3C/Name%3E%3CUserStyle%3E%3CName%3EUserSelection%3C/Name%3E%3CFeatureTypeStyle%3E%3CRule%3E%3CFilter%20xmlns:gml%3D%22http://www.opengis.net/gml%22%3E%3CPropertyIsEqualTo%3E%3CPropertyName%3Etipo%3C/PropertyName%3E%3CLiteral%3EFV%3C/Literal%3E%3C/PropertyIsEqualTo%3E%3C/Filter%3E%3CPointSymbolizer%3E%3CGraphic%3E%3CExternalGraphic%3E%3COnlineResource%20xmlns:xlink=%22http://www.w3.org/1999/xlink%22%20xlink:type=%22simple%22%20xlink:href=%22file:/D:/AppServ/www/SIGANAV/images/FV.gif%22/%3E%3CFormat%3Eimage/gif%3C/Format%3E%3C/ExternalGraphic%3E%3COpacity%3E%3CLiteral%3E1.0%3C/Literal%3E%3C/Opacity%3E%3CSize%3E%3CLiteral%3E20.0%3C/Literal%3E%3C/Size%3E%3CRotation%3E%3CLiteral%3E0.0%3C/Literal%3E%3C/Rotation%3E%3C/Graphic%3E%3C/PointSymbolizer%3E%3C/Rule%3E%3C/FeatureTypeStyle%3E%3C/UserStyle%3E%3C/UserLayer%3E%3C/StyledLayerDescriptor%3E
>
>
>
>
> and only change it the first part
>
> http://localhost:3128/geoserver/wms?bbox= -86.09240990784447,
> 19.463031059956343,-72.99589832490545,
> 23.6349399434799280&Format=image/png&request=GetMap&width=800&height=250&srs=EPSG:4267
>
>
>
>
> Well, I hope that you can be help me

The above is all I can find. I hope it will work after making these changes.

Regards,
Andreas.

-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.




___________________________________
Dirección de Comunicaciones
Grupo Empresarial GEOCUBA
Este mensaje esta libre de virus. 
Revisado por Kaspersky Antivirus
----------------------------------------------------------------------
Definition count:  2571166
Definition date:  9/15/2009
SecurityPlus version: 3.0.5

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20090915/566ded2e/attachment.html


More information about the Users mailing list