[OpenLayers-Users] Can't get GetLegendGraphic to work with &SLD=

Kimball, David (DCR) David.Kimball at state.ma.us
Tue Feb 3 12:28:02 EST 2009


Turns out there were some hidden characters "" at the beginning of the SLD XML file.  I don't know how they got there, and you can't see them in notepad, wordpad, XML Copy Editor, etc...thanks to Aleda for finding them!  So I started with an SLD file that DID work, deleted everything but the header section, and copied in the rest of the text from my SLD file after the header, and it works now.  Strangely, the part of GeoServer that does GetMap didn't seem to mind the extra characters (the SLD worked fine as far as symbolizing the map) but the GetLegendGraphic part choked on it.  Very strange, hopefully no one else will ever come across this weird problem.

--David


||||||| David Kimball
||||||| GIS Specialist
||||||| MA Department of Conservation and Recreation
||||||| http://www.mass.gov/dcr/stewardship/gis/
||||||| david.kimball at state.ma.us
||||||| 617.626.1447 phone
||||||| 617.626.1349 fax

-----Original Message-----
From: Christopher Schmidt [mailto:crschmidt at metacarta.com] 
Sent: Monday, February 02, 2009 10:49 AM
To: Kimball, David (DCR)
Cc: users at openlayers.org
Subject: Re: [OpenLayers-Users] Can't get GetLegendGraphic to work with &SLD=

On Mon, Feb 02, 2009 at 10:34:57AM -0500, Kimball, David (DCR) wrote:
> 
> Hi,
> 
> Can anyone help me troubleshoot why this doesn't return a legend
> graphic?
> 
> http://giswebservices.massgis.state.ma.us/geoserver/wms?VERSION=1.1.0&RE
> QUEST=GetLegendGraphic&LAYER=massgis:DCR.ROADS_TRAILS_POINT&SLD=http://m
> aps.massgis.state.ma.us/dcr/trails/sld/DCR.ROADS_TRAILS_POINT--Type_Max_
> 18000.sld.xml&WIDTH=16&HEIGHT=16&FORMAT=image/png

In general, the OpenLayers list will be better at helping you understand
why OpenLayers behaves in a certain way. Once you've narrowed it down to
a specific URL failing -- as you've done here, thank you for that --
you'll probably be able to get more from a GeoServer list than from the
OpenLayers list.

> It returns a file called "wms" that contains this error message:
> 
> <?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE
> ServiceExceptionReport SYSTEM
> "http://schemas.opengis.net/wms/1.1.1/WMS_exception_1_1_1.dtd">
> <ServiceExceptionReport version="1.1.1" >   <ServiceException>
>       org.xml.sax.SAXParseException: Content is not allowed in prolog.
> org.xml.sax.SAXParseException: Content is not allowed in prolog.
> Content is not allowed in prolog.
> </ServiceException></ServiceExceptionReport>

1. Check to make sure that GeoServer is actually reaching
maps.massgis.state.ma.us . It is possible that there is a proxy or
something getting in the way, preventing GeoServer from etching your
SLD.

2. Perhaps put a prolog on the SLD file? <?xml version='1.0' ?>

Other than that, it sounds like a bug. I'd try the GeoServer list and
see if anyone there has any advice, personally... 

-- Chris

> The layer massgis:DCR.ROADS_TRAILS_POINT and the SLD file
> http://maps.massgis.state.ma.us/dcr/trails/sld/DCR.ROADS_TRAILS_POINT--T
> ype_Max_18000.sld.xml work fine in a GetMap request [see
> http://maps.massgis.state.ma.us/dcr/trails/DCR_RoadTrail12.html - you
> need to zoom in to see the point layer].  Any idea why I'm not getting a
> legend image?  The URL looks like the URLs I've seen on the web and in
> other people's emails to this group as far as I can tell.  If I remove
> the &SLD=... portion of the URL it works (returns a simple default black
> dot legend).  And I've had no problem getting legends with &STYLE=...
> where the SLD file resides inside GeoServer as opposed to being a file
> on the web.   (note: the server is GeoServer).
> 
> Thanks a lot,
> 
> David
> 
> 
> 
> 
> ||||||| David Kimball
> ||||||| GIS Specialist
> ||||||| MA Department of Conservation and Recreation
> ||||||| http://www.mass.gov/dcr/stewardship/gis/
> ||||||| david.kimball at state.ma.us
> ||||||| 617.626.1447 phone
> ||||||| 617.626.1349 fax
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users

-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list