[MAPSERVER-USERS] SLD ignored / External Graphic ignored

Yewondwossen Assefa yassefa at dmsolutions.ca
Wed Apr 9 11:59:03 EDT 2008


Christian,

  I did a quick test using you sld at 
(http://sicky.i-networx.de/temp/mapserv/test.sld) with local data 
(adapted to fit the sld : 
http://localhost/cgi-bin/mapserv.exe?map=f:/msapps/world_testdata/map/sicky.map&SERVICE=WMS&VeRsIoN=1.1.1&Request=GetMap&LAYERS=Baugrenze&BBOX=-81.366241839,42.39269586,-77.8780568047,44.13861927&SLD=http://sicky.i-networx.de/temp/mapserv/test.sld&FORMAT=png&WIDTH=400&HEIGHT=300&SRS=EPSG:4326&FORMAT=png&WIDTH=400&HEIGHT=300&STYLES=
  and I was able to render the layer Baugrenze using the styles defined 
in the sld.  So I believe there is no issue with the sld. Common error 
is usually the SLD is not accessible but you mentioned that you already 
verified that

  2nd point is that external graphics can only be of type png or gif 
(and not SVG). The reason being is that currently MapServer does not 
support SVG symbols.

    I am using Mapserver svn. If you want me to do local tests with your 
map/data, you could zip and send it to me and I will give it a try.

Best Regards,


Sicky wrote:
> I'll start off with some background of what I'm trying to do:
> I want to define SVGs as external graphic in an SLD to use these as
> PointSymbolizers and LineSymbolizers. Firstly I tried GeoServer and it
> worked quite fine, the only problem was, that it wasn't rendered very good.
> So I thought of trying MapServer, but then the problems came...
> 
> I'm running the latest ms4w on Windows 2000 with Apache 2.2.8.
> 
> Here's link to my mapfile: http://sicky.i-networx.de/temp/mapserv/test.map
> 
> That's the SLD file I let create with the GetStyles request and just changed
> a color and width to see if it was recognized:
> http://sicky.i-networx.de/temp/mapserv/test.sld
> GetStyles document here:
> http://sicky.i-networx.de/temp/mapserv/GetStyles.txt
> 
> The important part of the GetCapabilities request is:
> <UserDefinedSymbolization SupportSLD="1" UserLayer="0" UserStyle="1"
> RemoteWFS="0"/>
> (the whole one is located here:
> http://sicky.i-networx.de/temp/mapserv/GetCapabilities.txt)
> 
> Since GetStyles is working fine and the wms server supports SLD I don't see
> a problem there (I searched the net for hours and hours to solve the problem
> and tried any suggestion..). But when I request a map with an SLD like this:
> http://localhost:8080/cgi-bin/mapserv.exe?map=/program%20files/ms4w/apps/blp/test.map&REQUEST=getMap&SERVICE=WMS&VERSION=1.1.1&SRS=EPSG:4326&BBOX=3954683.0884047896,5499947.559657593,3954754.5911026173,5499966.522156349&WIDTH=600&HEIGHT=700&LAYERS=Baugrenze,AllgWohngebiete&STYLES=&SLD=http://localhost:8080/test.sld&FORMAT=image/png
> 
> it just ignores the sld and shows this:
> http://sicky.i-networx.de/temp/mapserv/sld.png 
> 
> http://localhost:8080/test.sld itself is viewable in the browser without any
> problems and the names of the layers are mathcing those in the mapfile....
> (note: in my mapfile i commented out the style for one layer to see if a
> style in a mapfile overrides a sld)
> 
> I played around with this a bit, e.g. naming it 'test.xml', removing
> 'STYLES=' and so on... but nothing helped :(
> 
> The I thought of the other method to use SLDs, with SLD_BODY. My request is
> as follows:
> http://localhost:8080/cgi-bin/mapserv.exe?map=/program%20files/ms4w/apps/blp/test.map&REQUEST=getMap&SERVICE=WMS&VERSION=1.1.1&SRS=EPSG:4326&BBOX=3954683.0884047896,5499947.559657593,3954754.5911026173,5499966.522156349&LAYERS=Baugrenze,AllgWohngebiete&SLD_BODY=%3C%3Fxml+version%3D%221.0%22+encoding%3D%22UTF-8%22%3F%3E%3CStyledLayerDescriptor+version%3D%221.1.0%22%3E%3CNamedLayer%3E%3CName%3EBaugrenze%3C%2FName%3E%3CUserStyle%3E%3CFeatureTypeStyle%3E%3CRule%3E%3CName%3EBaugrenze%3C%2FName%3E%3CLineSymbolizer%3E%3CStroke%3E%3CCssParameter+name%3D%22stroke%22%3E%23000000%3C%2FCssParameter%3E%3CCssParameter+name%3D%22stroke-opacity%22%3E1.00%3C%2FCssParameter%3E%3CCssParameter+name%3D%22stroke-width%22%3E5%3C%2FCssParameter%3E%3C%2FStroke%3E%3C%2FLineSymbolizer%3E%3C%2FRule%3E%3C%2FFeatureTypeStyle%3E%3C%2FUserStyle%3E%3C%2FNamedLayer%3E%3CNamedLayer%3E%3CName%3EAllgWohngebiete%3C%2FName%3E%3CUserStyle%3E%3CFeatureTypeStyle%3E%3CRule%3E%3CName%3EAllgWohngebiete%3C%2FName%3E%3
CLineSymbolizer%3E%3CStroke%3E%3CCssParameter+name%3D%22stroke%22%3E%23ff00ff%3C%2FCssParameter%3E%3CCssParameter+name%3D%22stroke-opacity%22%3E1.00%3C%2FCssParameter%3E%3CCssParameter+name%3D%22stroke-width%22%3E5%3C%2FCssParameter%3E%3C%2FStroke%3E%3C%2FLineSymbolizer%3E%3C%2FRule%3E%3C%2FFeatureTypeStyle%3E%3C%2FUserStyle%3E%3C%2FNamedLayer%3E%3C%2FStyledLayerDescriptor%3E&WIDTH=600&HEIGHT=700&FORMAT=image/png
> 
> the sld_body part in plain text looks like this:
> <?xml version="1.0" encoding="UTF-8"?>
> <StyledLayerDescriptor version="1.1.0">
> <NamedLayer>
> <Name>Baugrenze</Name>
> <UserStyle><FeatureTypeStyle>
> <Rule><Name>Baugrenze</Name>
> <LineSymbolizer>
> <Stroke>
> <CssParameter name="stroke">#000000</CssParameter>
> <CssParameter name="stroke-opacity">1.00</CssParameter>
> <CssParameter name="stroke-width">5</CssParameter>
> </Stroke>
> </LineSymbolizer>
> </Rule>
> </FeatureTypeStyle>
> </UserStyle>
> </NamedLayer>
> <NamedLayer>
> <Name>AllgWohngebiete</Name>
> <UserStyle>
> <FeatureTypeStyle>
> <Rule>
> <Name>AllgWohngebiete</Name>
> <LineSymbolizer>
> <Stroke>
> <CssParameter name="stroke">#ff00ff</CssParameter>
> <CssParameter name="stroke-opacity">1.00</CssParameter>
> <CssParameter name="stroke-width">5</CssParameter>
> </Stroke>
> </LineSymbolizer>
> </Rule>
> </FeatureTypeStyle>
> </UserStyle>
> </NamedLayer>
> </StyledLayerDescriptor>
> 
> the result made me happy:
> http://sicky.i-networx.de/temp/mapserv/sld_body.png 
> 
> at least now i know that my mapserver definately works with SLDs. but this
> wouldn't be a solution since I really need to define a SLD file because it's
> gonna be very big. So i really want 'SLD=' to work instead of 'SLD_BODY'.
> 
> But 'SLD_BODY' doesn't work fine either :(
> when I try to use an external graphic like in this request:
> http://localhost:8080/cgi-bin/mapserv.exe?map=/program%20files/ms4w/apps/blp/test.map&REQUEST=getMap&SERVICE=WMS&VERSION=1.1.1&SRS=EPSG:4326&BBOX=3954683.0884047896,5499947.559657593,3954754.5911026173,5499966.522156349&LAYERS=Baugrenze,AllgWohngebiete&SLD_BODY=%3C%3Fxml+version%3D%221.0%22+encoding%3D%22UTF-8%22%3F%3E%3CStyledLayerDescriptor+version%3D%221.1.0%22%3E%3CNamedLayer%3E%3CName%3EBaugrenze%3C%2FName%3E%3CUserStyle%3E%3CFeatureTypeStyle%3E%3CRule%3E%3CName%3EBaugrenze%3C%2FName%3E%3CLineSymbolizer%3E%3CStroke%3E%3CGraphicStroke%3E%3CGraphic%3E%3CExternalGraphic%3E%3COnlineResource+xlink%3Ahref%3D%22http%3A%2F%2Flocalhost%3A8080%2FRsBaugrenze.svg%22%2F%3E%3CFormat%3Eimage%2Fsvg%2Bxml%3C%2FFormat%3E%3C%2FExternalGraphic%3E%3CSize%3E%3Cogc%3ALiteral%3E20%3C%2Fogc%3ALiteral%3E%3C%2FSize%3E%3C%2FGraphic%3E%3C%2FGraphicStroke%3E%3C%2FStroke%3E%3C%2FLineSymbolizer%3E%3C%2FRule%3E%3C%2FFeatureTypeStyle%3E%3C%2FUserStyle%3E%3C%2FNamedLayer%3E%3CNamedLayer%3E%3CName%3EAll
gWohngebiete%3C%2FName%3E%3CUserStyle%3E%3CFeatureTypeStyle%3E%3CRule%3E%3CName%3EAllgWohngebiete%3C%2FName%3E%3CLineSymbolizer%3E%3CStroke%3E%3CCssParameter+name%3D%22stroke%22%3E%23ff00ff%3C%2FCssParameter%3E%3CCssParameter+name%3D%22stroke-opacity%22%3E1.00%3C%2FCssParameter%3E%3CCssParameter+name%3D%22stroke-width%22%3E5%3C%2FCssParameter%3E%3C%2FStroke%3E%3C%2FLineSymbolizer%3E%3C%2FRule%3E%3C%2FFeatureTypeStyle%3E%3C%2FUserStyle%3E%3C%2FNamedLayer%3E%3C%2FStyledLayerDescriptor%3E&WIDTH=600&HEIGHT=700&FORMAT=image/png
> 
> in plain text the sld_body part looks like this:
> <?xml version="1.0" encoding="UTF-8"?>
> <StyledLayerDescriptor version="1.1.0">
> <NamedLayer>
> <Name>Baugrenze</Name>
> <UserStyle>
> <FeatureTypeStyle>
> <Rule>
> <Name>Baugrenze</Name>
> <LineSymbolizer>
> <Stroke>
> <GraphicStroke>
> <Graphic>
> <ExternalGraphic>
> <OnlineResource xlink:href="http://localhost:8080/RsBaugrenze.svg"/>
> <Format>image/svg</Format>
> </ExternalGraphic>
> <Size><ogc:Literal>20</ogc:Literal></Size>
> </Graphic>
> </GraphicStroke>
> </Stroke>
> </LineSymbolizer>
> </Rule>
> </FeatureTypeStyle>
> </UserStyle>
> </NamedLayer>
> <NamedLayer>
> <Name>AllgWohngebiete</Name>
> <UserStyle>
> <FeatureTypeStyle>
> <Rule>
> <Name>AllgWohngebiete</Name>
> <LineSymbolizer>
> <Stroke>
> <CssParameter name="stroke">#ff00ff</CssParameter>
> <CssParameter name="stroke-opacity">1.00</CssParameter>
> <CssParameter name="stroke-width">5</CssParameter>
> </Stroke>
> </LineSymbolizer>
> </Rule>
> </FeatureTypeStyle>
> </UserStyle>
> </NamedLayer>
> </StyledLayerDescriptor>
> 
> http://localhost:8080/RsBaugrenze.svg of course works fine, is available and
> geoserver had no problem using it as well.
> 
> but the result is this:
> http://sicky.i-networx.de/temp/mapserv/sld_body_ext.png 
> So it styles one layer with CSS parameteres but not the other one with an
> external graphic.
> 
> To conclude:
> 1st problem: If I give the request an 'SLD=' it just gets ignored. Why? How
> can I fix this?
> 2nd problem: Why gets the external graphic in the SLD gets ignored?
> 
> I'm pretty new to MapServer/GIS in general and hope I made myself clear and
> haven't forgotten anything important. If so, please say so and I give you
> the info which might help me solve this problem.
> And I hope the german words inside some of the documents don't confuse you.
> 
> I would be really really happy if somebody could help me. And I would be
> grateful if this happens fast, since I need to solve this problem fastly
> because I need it to be solved to get on with my bachelor thesis.
> 
> Thanks in Advance,
> Christian.


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