[mapserver-users] Styling a mapfile with SLD?

Jörg Thomsen jt at mapmedia.de
Tue Jun 1 11:23:25 EDT 2010


Hi,

and thanks for the 2nd try with a readable mail ;)

paalkr wrote:
>
> 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.

1.
be sure that your umn can access the sld via http, how do you call it 
within the url?

2.
the problem is, that umn does not provide any error-message if a sld 
does not work, umn has no access to it or the sld has errors. In this 
cases the map is rendered with the style-parameters of the mapfile.

If I try to load
http://www.geonorge.no/styles/erm/erm_ms_22_ah.xml
in Opera I get one syntax-error in line 41, in <StyledLayerDescriptor> 
the '/' is missing. And having a dedicated look, I find a lot of tags 
which should be closing-tags but don't have a backslash...

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

Regards, Jörg

>
> 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


-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Aufwind durch Wissen!

Qualifizierte Open Source Schulungen bei der
http://www.foss-akademie.de/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

_________________________________________________

MapMedia
Kartographie und raumbezogene Informationssysteme

Gillweg 3, 14193 Berlin
fon: +49 30 89 06 82-70
fax: +49 30 89 09 53-21
mail: jt at mapmedia.de
net:  www.mapmedia.de
_________________________________________________



Geschäftsführer: G. v. Tschirnhaus, J. Thomsen, P. Stamm
Registergericht, Berlin - Amtsgericht Charlottenburg,
HRB 89625, Umsatzsteuer-Identnummer: DE 813794062


More information about the mapserver-users mailing list