[OpenLayers-Users] mergeNewParams not working

bartvde at osgis.nl bartvde at osgis.nl
Fri Nov 13 03:39:38 EST 2009


You should apply it to the polygon layer.

What WMS are you using? Mapserver? Try to put your SLD XML on a webserver
and reference it with the SLD parameter without the use of OpenLayers in
between. If this does not work, you might have better luck asking on the
mailing list of your server product.

Have you tried without the xsl stuff embedded in your XML?

Also, things like PropertyIsEqualTo etc need to be in the ogc prefix, not
sure if this is the problem though (some WMS-s are quite permissive).

Best regards,
Bart

>
> Sure, here it is:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="1.0.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> 	<xsl:output omit-xml-declaration="yes" method="xml"/>
> 	<xsl:param name="objetoPila" select="null"/>
> 	<xsl:template match="/">
> 		<StyledLayerDescriptor version="1.0.0"
> xsi:schemaLocation="http://www.opengis.net/sld
> 			StyledLayerDescriptor.xsd" xmlns="http://www.opengis.net/sld"
> 			xmlns:ogc="http://www.opengis.net/ogc"
> 			xmlns:xlink="http://www.w3.org/1999/xlink"
> 			xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> 		      	<NamedLayer>
> 		    		<Name>RecintosSigpac</Name>
> 		      		<UserStyle>
> 		        		<Name>Selección de Recintos</Name>
> 		        		<Title>Título</Title>
> 						<Abstract>Comentarios</Abstract>
> 		        		<FeatureTypeStyle>
> 							<Rule>
> 		        				<ogc:Filter xmlns:gml="http://www.opengis.net/gml">
> 								<ogc:And>
> 									<PropertyIsEqualTo>
> 										<PropertyName>PROVINCIA</PropertyName>
> 										<Literal>1</Literal>
> 									</PropertyIsEqualTo>
> 									<PropertyIsEqualTo>
> 										<PropertyName>MUNICIPIO</PropertyName>
> 										<Literal>1</Literal>
> 									</PropertyIsEqualTo>
> 									<PropertyIsEqualTo>
> 											<PropertyName>POLIGONO</PropertyName>
> 											<Literal>1</Literal>
> 									</PropertyIsEqualTo>
> 									<PropertyIsEqualTo>
> 											<PropertyName>PARCELA</PropertyName>
> 											<Literal>1</Literal>
> 									</PropertyIsEqualTo>
> 									<PropertyIsEqualTo>
> 											<PropertyName>RECINTO</PropertyName>
> 											<Literal>1</Literal>
> 									</PropertyIsEqualTo>
> 								</ogc:And>
> 								</ogc:Filter>
> 		        				<PolygonSymbolizer>
> 									<Fill>
> 		        						<CssParameter name="fill">#FFCC66</CssParameter>
> 										<CssParameter name="fill-opacity">0.5</CssParameter>
> 		        					</Fill>
> 									<Stroke>
> 										<CssParameter name="stroke">#00FF00</CssParameter>
> 										<CssParameter name="stroke-width">3</CssParameter>
> 									</Stroke>
> 		        				</PolygonSymbolizer>
> 		        			</Rule>
> 						</FeatureTypeStyle>
> 		        	</UserStyle>
> 		        </NamedLayer>
> 		</StyledLayerDescriptor>
> 	</xsl:template>
> </xsl:stylesheet>
>
>
> One more question, I have 2 layers, both are taken from my WMS but one is
> a raster file, that acts as base layer, and the other one is polygon
> layer. In which of them do I have to apply the new params??. I've tried
> appliying them in my polygon layer.
>
> Thanks.
>
>
> Un saludo,
>
> ··················································································
>
> David Alda Fernández de Lezea
> Lurralde eta Biodibertsitate Saila / Dpto. de Territorio y Biodiversidad
>
> IKT
> Granja Modelo s/n · 01192 · Arkaute (Araba)
>
> ··················································································
> Tlfnos.: 945-00-32-95                         Fax: 945-00.32.90
> ··················································································
> email: dalda at ikt.es                                web: www.ikt.es
> ··················································································
>
> -----Mensaje original-----
> De: bartvde at osgis.nl [mailto:bartvde at osgis.nl]
> Enviado el: viernes, 13 de noviembre de 2009 9:18
> Para: David Alda Fernandez de Lezea
> CC: users at openlayers.org
> Asunto: Re: [OpenLayers-Users] mergeNewParams not working
>
> Can you post the contents of your SLD XML?
>
> Best regards,
> Bart
>
>> Hello,
>>
>> I want to apply some SLD generated on the fly through SLD_BODY
>> parameter using the following code:
>>
>> var sld = getSLD("sld1.xsl","pilaXML.xml"); var wms =
>> map.getLayersByName("myLayerName")[0];
>> wms.mergeNewParams({SLD_BODY: sld});
>>
>> but I don't get any result. The image is refreshed in the browser but
>> there's no selection at all. I've got a debug file for my WMS server
>> and I don't seem to get any error:
>>
>> [Fri Nov 13 09:00:18 2009].346000 CGI Request 1 on process 5940
>>
>> My SLD contains 2084 characters, it could be that the problem? Or
>> maybe I'm doing something wrong. Has anybody any idea of what's
>> happening??
>>
>> Thanks.
>>
>>
>>
>>
>>
>>
>> Un saludo,
>>
>>
>>
>> ······································································
>> ············
>>
>>
>> David Alda Fernández de Lezea
>>
>> Lurralde eta Biodibertsitate Saila / Dpto. de Territorio y
>> Biodiversidad
>>
>>
>>
>> IKT
>>
>> Granja Modelo s/n · 01192 · Arkaute (Araba)
>>
>>
>> ··················································································
>> Tlfnos.: 945-00-32-95                         Fax: 945-00.32.90
>> ··················································································
>> email: dalda at ikt.es                                web: www.ikt.es
>> <http://www.ikt.es/>
>> ······································································
>> ············
>>
>> _______________________________________________
>> Users mailing list
>> Users at openlayers.org
>> http://openlayers.org/mailman/listinfo/users
>>
>
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>





More information about the Users mailing list