[MS4W-Users] Rotate symbols using SLD and database field

Jeff McKenna jmckenna at gatewaygeomatics.com
Wed Aug 25 07:42:02 EST 2010


Hello,

Have you verified that your ANGLE [orientation] works correctly through 
the shp2img commandline? http://www.mapserver.org/utilities/shp2img.html 
(can you generate a map image with shp2img, reading the value from the 
database?)


-jeff


-- 
Jeff McKenna
MapServer Consulting and Training Services
http://www.gatewaygeomatics.com/




On 10-08-25 8:17 AM, Srilakshmi Kandala wrote:
> Hi,
>
> I am working with *ms4w_3.0_beta11* and *OpenLayers* to render maps. The
> data for the map, exists in PostGIS database. I am trying to apply
> rotation to symbols using SLD, but it does not seem to work. A part of
> the mapfile i am using is as follows:
>
> Symbol
> Name 'iftriangle'
> Type VECTOR
> Filled TRUE
> Points
> 0 0
> .5 2
> 1 0
> 0 0
> END
> END
>
> LAYER
> NAME 'Sectors_GSM'
> TYPE point
> CONNECTIONTYPE POSTGIS
> CONNECTION 'host=localhost user=postgres port=5432 dbname=dbname
> password=pwd'
> DATA 'wkb_geometry from tablename USING UNIQUE ogc_fid using SRID=900914'
> METADATA
> 'wms_title' 'Sectors'
> END
>
> STATUS ON
> TRANSPARENCY 100
> PROJECTION
> "init=EPSG:900913"
> END
>
> CLASSITEM 'antenna_type'
> CLASS
> NAME 'GSM'
> STYLE
> SYMBOL 'iftriangle'
> SIZE 15
> COLOR 51 51 204
> ANGLE [orientation]
> END
> END
> END
>
>
> This layer renders correctly. But when i try to apply a filter using
> SLD, the map renders, but the symbols are not rotated. Here is the SLD
> file i am using:
>
> <StyledLayerDescriptor version="1.1.0"
> xmlns="http://www.opengis.net/sld" xmlns:se="http://www.opengis.net/se"
> xmlns:ogc="http://www.opengis.net/ogc"
> xmlns:xlink="http://www.w3.org/1999/xlink"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://www.opengis.net/sld
> http://schemas.opengis.net/sld/1.1.0/StyledLayerDescriptor.xsd">
> <NamedLayer>
> <se:Name>Sectors</se:Name>
> <UserStyle>
> <se:FeatureTypeStyle>
> <se:Rule>
> <se:Name>M</se:Name>
> <ogc:Filter>
> <ogc:PropertyIsEqualTo>
> <ogc:PropertyName>antenna_type</ogc:PropertyName>
> <ogc:Literal>M</ogc:Literal>
> </ogc:PropertyIsEqualTo>
> </ogc:Filter>
> <se:PointSymbolizer>
> <se:Graphic>
> <se:Mark>
> <se:WellKnownName>iftriangle</se:WellKnownName>
> <se:Fill>
> <se:CssParameter name="fill">#660033</se:CssParameter>
> </se:Fill>
> </se:Mark>
> <se:Size>15</se:Size>
> <se:Rotation>
> <ogc:PropertyName>orientation</ogc:PropertyName>
> </se:Rotation>
> </se:Graphic>
> </se:PointSymbolizer>
> </se:Rule>
> </se:FeatureTypeStyle>
> </UserStyle>
> </NamedLayer>
> </StyledLayerDescriptor>
>
> I have also tried the above with SLD version 1.0.0. Nothing seems to
> work. But if i give
> <se:Rotation>45</se:Rotation>, it works. The symbols are rotated by 45
> degrees.
>
> I need to get that angle from PostGIS database. Please help me.
>



More information about the MS4W-Users mailing list