[mapserver-users] Styling a mapfile with SLD?

paalkr pal.kristensen at statkart.no
Tue Jun 1 07:57:28 PDT 2010


Hi all!

I'm trying to sett up a MapService that uses OGC SLD to override the regular
MapServer rendering rules (classes and styles). For some reason MapServer
does not seem to pick up the SLD, because the resulting map uses the default
drawing rules defined in the map-file rather then the SLD.

And BTW, is it possible to assign a SLD to a layer internally in a map-file,
or do I need to provide the SLD as a parameter in the WMS GetMap request?

The layer in the mapfile looks like this:

  LAYER
    NAME "PolbndA"
    TYPE POLYGON
	#TYPE LINE
    STATUS OFF
	DEBUG 5
    MAXSCALEDENOM 1900000
      CONNECTIONTYPE postgis
      CONNECTION "host=xx port=5432 dbname=xx password=xx user=xx"
      DATA "shape from euroerm.polbnda USING UNIQUE objectid USING
SRID=4326"
      PROCESSING "CLOSE_CONNECTION=DEFER"	
    METADATA
      "wms_title"             "Administrativie area"
      "wms_extent"            "-15 28 47 82"
      #"wms_sld_url" "http://www.geonorge.no/styles/erm/erm_ms_22_ah.xml"
      #"wms_sld_body" "AUTO" 
    END
    PROJECTION
      "init=epsg:4326"
    END

    #LABELITEM "f_code"
	CLASSITEM "f_code"

    CLASS
      NAME "F_CODE"
      STYLE
        OUTLINECOLOR 255 100 0
        SIZE 2
      END
      LABEL
        COLOR 0 0 0
        FONT verdana
        TYPE TRUETYPE
        SIZE 10
        PARTIALS false
        POSITION lc
      END
    END
  END

The corresponding SLD document that I try to apply:

<?xml version="1.0" encoding="utf-8"?>
<StyledLayerDescriptor version="1.1.0"
 schemaLocation="http://www.opengis.net/sld
http://schemas.opengis.net/sld/1.1.0/StyledLayerDescriptor.xsd"
 xmlns="http://www.opengis.net/sld"
 xmlns:ogc="http://www.opengis.net/ogc"
 xmlns:se="http://www.opengis.net/se"
 xmlns:xlink="http://www.w3.org/1999/xlink"
 xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns:sld="http://www.opengis.net/sld">
  <!--Area features.-->
  <NamedLayer>
    <Name>PolbndA<Name>
    <UserStyle>
      <Name>erm:Style1<Name>
      <Title>Default Styler<Title>
      <FeatureTypeStyle>
        <!--FeatureTypeName>WFS_ERM:Fcode_FA001_A<FeatureTypeName-->
        <Name>PolbndA<Name>
        <Title>title<Title>
        <Abstract>abstract<Abstract>
        <!--SemanticTypeIdentifier>generic:all<SemanticTypeIdentifier-->
        <Rule>
          <Title>Administrative Area<Title>
          <Name>Administrative Area<Name>
          <ogc:Filter>
            <ogc:PropertyIsEqualTo>
              <ogc:PropertyName>f_code</ogc:PropertyName>
              <ogc:Literal>FA001</ogc:Literal>
            </ogc:PropertyIsEqualTo>
          </ogc:Filter>
          <PolygonSymbolizer>
            <Fill>
              <SvgParameter name="fill">#FFFFE6<SvgParameter>
              <SvgParameter name="fill-opacity">1<SvgParameter>
            <Fill>
          <PolygonSymbolizer>
        <Rule>
      <FeatureTypeStyle>
    <UserStyle>
  <NamedLayer>
<StyledLayerDescriptor>

-----

Regards,
Pål Kristensen
-- 
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Styling-a-mapfile-with-SLD-tp5126381p5126381.html
Sent from the Mapserver - User mailing list archive at Nabble.com.



More information about the MapServer-users mailing list