0

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.

2 Answers 2

2

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.

1

Check OpenLayers 2.13 it might have a solutin

1
  • Nope, unfortunately not. See accepted answer.
    – abettermap
    Commented Feb 27, 2017 at 0:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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