geostyler / geostyler-demo

GeoStyler Demo App
https://geostyler.github.io/geostyler-demo/
BSD 2-Clause "Simplified" License
8 stars 12 forks source link

Code Editor cannot handle SLD generated by QGIS #271

Closed simonokeefe closed 3 years ago

simonokeefe commented 3 years ago

Bug

The Code Editor becomes disabled and displays "An error occured in the CodeEditor UI." when pasting in SLD text that was generated from QGIS.

image

To Reproduce

  1. Go to https://geostyler.github.io/geostyler-demo/
  2. Change Code Editor Format drop-down to 'SLD 1.1.0 - Symbology Encoding'
  3. Select all existing text in Code Editor
  4. Copy the SLD text (below) and paste into Code Editor to replace existing text
<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor xmlns="http://www.opengis.net/sld" xmlns:se="http://www.opengis.net/se" xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.1.0/StyledLayerDescriptor.xsd" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.1.0" xmlns:xlink="http://www.w3.org/1999/xlink">
  <NamedLayer>
    <se:Name>CFA_WGS84</se:Name>
    <UserStyle>
      <se:Name>CFA_WGS84</se:Name>
      <se:FeatureTypeStyle>
        <se:Rule>
          <se:Name>Single symbol</se:Name>
          <se:PointSymbolizer>
            <se:Graphic>
              <se:Mark>
                <se:WellKnownName>circle</se:WellKnownName>
                <se:Fill>
                  <se:SvgParameter name="fill">#f3a6b2</se:SvgParameter>
                </se:Fill>
                <se:Stroke>
                  <se:SvgParameter name="stroke">#232323</se:SvgParameter>
                  <se:SvgParameter name="stroke-width">0.5</se:SvgParameter>
                </se:Stroke>
              </se:Mark>
              <se:Size>7</se:Size>
            </se:Graphic>
          </se:PointSymbolizer>
        </se:Rule>
      </se:FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>

This SLD text was generated by QGIS 3.16 LTR for a simple point layer with no adjustments made to the default values.

The error occurs in Chrome and Firefox.

In the dev environment, it generates this error report:

image

jansule commented 3 years ago

Thanks for the info @simonokeefe.

The Code Editor actually crashed every time a change was made. Even just changing the name of the style.

A fix for the bug in the Code Editor was already created by @KaiVolland in https://github.com/geostyler/geostyler/pull/1503 and released in geostyler v7.2.1.

I just updated the GeoStyler-Demo to use that version of GeoStyler and deployed it. So now, everything should work as expected.

Feel free to reopen the issue in case it still does not work for you.

simonokeefe commented 3 years ago

Thanks @jansule and @KaiVolland! Working great now.