[mapserver-users] Problems with SLD

David Alda Fernandez de Lezea dalda at ikt.es
Thu Nov 19 02:54:46 EST 2009


 
Hello, 

Thanks for your response. I have MapServer 5.2.1 but I didn't know about the format AGG. Searching in google I've found the way to solve this by having in my mapfile something like:

OUTPUTFORMAT
	NAME png
	DRIVER "AGG/PNG"
	MIMETYPE "image/png"
	IMAGEMODE RGBA
	EXTENSION "png"
	FORMATOPTION "TRANSPARENT=ON"
	FORMATOPTION "INTERLACE=OFF"
END


Now I can see the selection with transparency, and I must tell you that the rendering of my polygons is better now (Thanks, it looks great).

I have another question, I'm trying also to label this polygons with some atributes. I can see the labels but, the problem is that I want them to be on the centroid of the polygon. And also I'm having these labels repeated over the polygon. My SLD definition:

<?xml version="1.0" encoding="UTF-8"?>
		<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>
							<!-- Mark selected parcel -->
							<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">#00CCFF</CssParameter>
										<CssParameter name="fill-opacity">0.45</CssParameter> 
		        					</Fill>
		        				</PolygonSymbolizer>
								<PolygonSymbolizer>
									<Stroke> 
										<CssParameter name="stroke">#FFCC66</CssParameter> 
										<CssParameter name="stroke-width">1</CssParameter> 
									</Stroke>
								</PolygonSymbolizer>									
								<TextSymbolizer>
									<sld:MinScaleDenominator>3000</sld:MinScaleDenominator>
									<sld:MaxScaleDenominator>5000</sld:MaxScaleDenominator>
									<Label>
										<ogc:PropertyName>PROVINCIA</ogc:PropertyName>
										/<ogc:PropertyName>MUNICIPIO</ogc:PropertyName>									
										/<ogc:PropertyName>POLIGONO</ogc:PropertyName>
										/<ogc:PropertyName>PARCELA</ogc:PropertyName>
										/<ogc:PropertyName>RECINTO</ogc:PropertyName>
									</Label> 
									<Font> 
										<CssParameter name="font-family">Arial</CssParameter> 
										<CssParameter name="font-weight">bold</CssParameter> 
										<CssParameter name="font-size">8</CssParameter> 
									</Font> 
									<!-- this centers the label on the polygon's centroid-->
								    <LabelPlacement>
								      <PointPlacement>	
											<AnchorPoint>
											  <AnchorPointX>0.5</AnchorPointX>
											  <AnchorPointY>0.5</AnchorPointY>
											</AnchorPoint>
								      </PointPlacement>					    
								    </LabelPlacement>
								    
								     <!--  make the label easy to read-->
								    <Halo>				    
										  <Radius>
												<ogc:Literal>2</ogc:Literal>
										  </Radius>
										  <Fill>
											<CssParameter name="fill">#FFFFFF</CssParameter>
											<CssParameter name="fill-opacity">0.85</CssParameter>				
										  </Fill>
								    </Halo>
									<Fill>
										<CssParameter name="fill">#000000</CssParameter>		
								    </Fill>
									<!-- This labels each name only once, not every shape with that name -->
									<VendorOption name="group">true</VendorOption>
								</TextSymbolizer>
		        			</Rule>
							<!-- For the rest of the parcels I apply this style -->
							<Rule>
		        				<ogc:Filter xmlns:gml="http://www.opengis.net/gml">
								<ogc:Or>
								<PropertyIsNotEqualTo>
									<PropertyName>PROVINCIA</PropertyName>
									<Literal>1</Literal>
								</PropertyIsNotEqualTo>
								<PropertyIsNotEqualTo>
									<PropertyName>MUNICIPIO</PropertyName>
									<Literal>1</Literal>
								</PropertyIsNotEqualTo>
								<PropertyIsNotEqualTo>
									<PropertyName>POLIGONO</PropertyName>
									<Literal>1</Literal>
								</PropertyIsNotEqualTo>
								<PropertyIsNotEqualTo>
									<PropertyName>PARCELA</PropertyName>
									<Literal>1</Literal>
								</PropertyIsNotEqualTo>
								<PropertyIsNotEqualTo>
									<PropertyName>RECINTO</PropertyName>
									<Literal>1</Literal>
								</PropertyIsNotEqualTo>								
								</ogc:Or>
								</ogc:Filter>
		        				<PolygonSymbolizer>
									<Stroke> 
										<CssParameter name="stroke">#4CFF00</CssParameter> 
										<CssParameter name="stroke-width">1</CssParameter> 
									</Stroke> 
		        				</PolygonSymbolizer>
								<TextSymbolizer>								
									<Label>
										<ogc:PropertyName>PROVINCIA</ogc:PropertyName>
										/<ogc:PropertyName>MUNICIPIO</ogc:PropertyName>									
										/<ogc:PropertyName>POLIGONO</ogc:PropertyName>
										/<ogc:PropertyName>PARCELA</ogc:PropertyName>
										/<ogc:PropertyName>RECINTO</ogc:PropertyName>
									</Label> 
									<Font> 
										<CssParameter name="font-family">Arial</CssParameter> 
										<CssParameter name="font-weight">bold</CssParameter> 
										<CssParameter name="font-size">8</CssParameter> 
									</Font> 
									<!-- this centers the label on the polygon's centroid-->
								    <LabelPlacement>
								      <PointPlacement>	
											<AnchorPoint>
											  <AnchorPointX>0.5</AnchorPointX>
											  <AnchorPointY>0.5</AnchorPointY>
											</AnchorPoint>
								      </PointPlacement>					    
								    </LabelPlacement>
								    
								     <!--  make the label easy to read-->
								    <Halo>				    
										  <Radius>
												<ogc:Literal>2</ogc:Literal>
										  </Radius>
										  <Fill>
											<CssParameter name="fill">#FFFFFF</CssParameter>
											<CssParameter name="fill-opacity">0.85</CssParameter>				
										  </Fill>
								    </Halo>
									<Fill>
										<CssParameter name="fill">#000000</CssParameter>		
								    </Fill>
									<!-- This labels each name only once, not every shape with that name -->
									<VendorOption name="group">true</VendorOption>
								</TextSymbolizer>
		        			</Rule>
						</FeatureTypeStyle>
		        	</UserStyle>
		        </NamedLayer>
		</StyledLayerDescriptor>



 
 
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: Yewondwossen Assefa [mailto:yassefa at dmsolutions.ca] 
Enviado el: miércoles, 18 de noviembre de 2009 17:22
Para: David Alda Fernandez de Lezea
CC: mapserver-users at lists.osgeo.org
Asunto: Re: [mapserver-users] Problems with SLD


David Alda Fernandez de Lezea wrote:
> Hello,
>  
> I'm quite new in MapServer, and I'm trying to apply some SLD's to a 
> polygon layer served via WMS with MapServer, and I want these ploygons 
> to have some transparency, and I specify the field fill-opacity to 0.5 
> but in the returned image the polygon is filled with opacity = 1. What 
> could be happening??
>  
> Thanks.
>  
>
>  
>
David,

 The fill-opacity parameter should be supported as MapServer version 5.2. Note also that style level opacity is only available through the AGG format.  If both these cases are met and you still have an issue, you can send me/point me to your sld and I can give it a quick look.

regards,

--
----------------------------------------------------------------
Assefa Yewondwossen           
Software Analyst   

Email: assefa at dmsolutions.ca    
http://www.dmsolutions.ca/

Phone: (613) 565-5056 (ext 14)
Fax:   (613) 565-0925
----------------------------------------------------------------




More information about the mapserver-users mailing list