Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am using Openlayers 2.11 and need to style a layer with a sld file version 1.1.0. the error it says is Uncaught Can't find a SLD parser for version 1.1.0. i have also tried it with Openlayers 2.12.

share|improve this question

2 Answers 2

Check OpenLayers 2.13 it might have a solutin

share|improve this answer

No, OpenLayers 2.13.1 does not parse 1.1.0 SLD- I get the same error as the OP when using a 1.1.0 SLD file for a GeoJSON layer. Fortunately I found a (sloppy) workaround via some find-and-replace magic in the SLD file:

  1. Changed beginning of file (xml prologue is it called??) to match 1.0 standards:

    <?xml version="1.0" encoding="UTF-8"?> <sld:StyledLayerDescriptor version="1.0.0" xmlns:sld="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml" 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">

  2. Changed all instances of SvgParameter to CssParameter (credit to the suggestion at the end of this post).
  3. Changed all instances of <se:whatever>stuff</se:whatever> to <sld:whatever>stuff</sld:whatever> (this may have been just a QGIS feature, I am not sure).

Like I said, not pretty, but it allowed me to adapt a 1.1.0 SLD file exported from QGIS and then parse it in OpenLayers.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.