[mapserver-users] Trouble shooting SLD?
Barend Köbben
kobben at itc.nl
Tue Oct 19 23:44:02 PDT 2010
HI,
I missed the beginning of this thread, just chip in to ask if you did not
overlook the basis: Does MS actually read the SLD? I found that to be a
problem in earlier work, see below an extract from an old mail to this list.
If it's not that, sorry...
Barend Köbben (ITC)
<quote>
(..) Almost always I find this kind of problem having not much to do
with the SLDs themselves, but with TMP file settings. This is certainly more
likely if you say sending the SLD it in SLD-BODY works.
Using SLDs is dependent on the correct setting of the two settings
IMAGEPATH -- where the mapserver software puts the SLD and other temporary
files
IMAGEURL -- where the web browser and other http services pick them up.
Setting these incorrectly, and more importantly their security setting
incorrrectly, will normally give no problems, but when using SLDs (and also
in other cases, eg. when chaining Mapserver to external WMS and WFS
services), they will make MS malfunction, but SILENTLY (ie. No error
messages).
Eg. in our set ups of a WMS with external SLD they are set as follows:
For a *nix setup ( MacOSX) with Mapserver CGI 'behind' Apache:
WEB
IMAGEPATH "/Users/kobben/Sites/ms_tmp/"
IMAGEURL "http://localhost/~kobben/ms_tmp/"
#--------------------------------------------#
METADATA
[all your web metadata...]
END #metadata
END #web
For a Win box with Mapserver CGI 'behind' IIS:
IMAGEPATH "C:/tmp/ms_tmp/"
IMAGEURL "http://geoserver.itc.nl/ms_tmp/"
The IMAGEPATh is a directory that is reacheable by Mapserver at this real
location (in this case expressed as Unix BSD path on my MacOSX or as UNC
path on Win) and that has read & write access set for the Mapserver
process. Eg. on the Winbox it should have write access for the anonymous
system service account under which Mapserver runs (usually something like
SERVERNAME\IWAM_SERVERNAME).
You can test this by seeing if files with names like) are being created when
you request the WMS with external SLD. If they are the IMAGEPATH celarly
works. Then test if you can point a browser to the IMAGEURL and pick up the
tmp file. If that worsk the IMAGEURL is also OK. Now it should work...
Hope this helps.
</quote>
On 19-10-10 22:44, "K" <ken at sandnarrows.com> wrote:
> Thanks again for your assistance.
>
> The SLD file I was using was from the mapserver repository that Jeff
> posted earlier in the thread. I went ahead and edited it and removed all
> the differing bits from yours. No change, still not reading the SLD file.
>
> I then decided to create a line file, in case the issue was polygons,
> and use the SLD file you posted, with the only change being the name,
> still not working.
>
> I went through and changed all the names to be different, then tried
> matching the SLD name with different parts in the odd hope it would
> work, again no luck.
>
> No matter what I do it seems the SLD is being ignored.
>
> Ken
>
> On 19/10/2010 3:52 AM, Rahkonen Jukka wrote:
>>
>> Hi,
>>
>> I have never made a single SLD file myself, just edited something
>> working that I have found so unfortunately I fear I cannot give very
>> good advice. I did, however, compare something that works for me and
>> your SLD file and these are the differences:
>>
>> My first line has more elements:
>> <StyledLayerDescriptor version="1.0.0"
>> xmlns="http://www.opengis.net/sld"
>> xmlns:gml="http://www.opengis.net/gml"
>> 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.0.0/StyledLayerDescriptor.xsd">
>>
>> You have Title, I don't. Hard to believe this is critical, though
>> <Title>Communities</Title>
>>
>> Then you are giving the geometry element as
>>
>> <Geometry>
>> <PropertyName>Communities</PropertyName>
>> </Geometry>
>>
>> I do not have that element at all. Mapserver documentation says that it
>> is not supported and I also believe that now it is wrong in your SLD. I
>> understand that your SLD is trying to telll now that the geometry of
>> your layer is stored in a field named "Communities". By the way, it
>> might be better to use different names in various places instead of
>> "Communities" everywhere at least when testing.
>>
>> Geoserver folks have made a SLD cookbook
>> http://docs.geoserver.org/stable/en/user/styling/sld-cookbook/index.html
>> it is probably worth reading.
>>
>> And here is the SLD that I looked at when doing comparison. I took it
>> out from my working Mapserver layer with GetStyles. Perhaps you could
>> try the same, style your layer to look good by editing the mapfile and
>> take the SLD out with GetStyles and you should have a good template in
>> your hands.
>>
>>
>> <StyledLayerDescriptor version="1.0.0"
>> xmlns="http://www.opengis.net/sld"
>> xmlns:gml="http://www.opengis.net/gml"
>> 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.0.0/StyledLayerDescriptor.xsd">
>> <NamedLayer>
>> <Name>maxspeed_query</Name>
>> <UserStyle>
>> <FeatureTypeStyle>
>> <Rule>
>> <LineSymbolizer>
>> <Stroke>
>> <CssParameter name="stroke">#ff0000</CssParameter>
>> <CssParameter name="stroke-opacity">1.00</CssParameter>
>> <CssParameter name="stroke-width">3.00</CssParameter>
>> </Stroke>
>> </LineSymbolizer>
>> </Rule>
>> </FeatureTypeStyle>
>> </UserStyle>
>> </NamedLayer>
>> </StyledLayerDescriptor>
>>
>> -Jukka Rahkonen-
>>
>>
>> K wrote
>>
>>> As I am still unable to get my SLD to work, I wonder if the
>>> shape file
>>> (is it a shape file?) and map file for that example is available to
>>> download somewhere? This way I can toss it on my server and
>>> it would let
>>> me see if my problem is software related, rather then something wrong
>>> with my files.
>>>
>>> Thanks,
>>>
>>> Ken
>>>
>>> On 18/10/2010 5:31 PM, Jeff McKenna wrote:
>>>> On 10-10-18 11:16 AM, Rahkonen Jukka wrote:
>>>>> I noticed that none of the full request links in the document
>>>>> http://mapserver.org/ogc/sld.html are working now
>>>>
>>>> Good catch Jukka. The examples should be working again,
>>> please re-try.
>>>>
>>>> -jeff
>>>>
>>>>
>>> _______________________________________________
>>> mapserver-users mailing list
>>> mapserver-users at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>>>
>>
>>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
More information about the MapServer-users
mailing list