0

I was trying to put style of color classification that was created in QGIS. It works in Geoserver but the colors are not shown. It is always single color. I have read that this is often a problem with some versions of QGIS, but I do not know how to solve it. It would be helpful if someone knows what should I change in code.

<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor xmlns="http://www.opengis.net/sld" 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" units="mm" xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.1.0/StyledLayerDescriptor.xsd" xmlns:se="http://www.opengis.net/se">
  <NamedLayer>
    <se:Name>coordinates</se:Name>
    <UserStyle>
      <se:Name>coordinates</se:Name>
      <se:FeatureTypeStyle>
        <se:Rule>
          <se:Name>Railways used for public transport</se:Name>
          <se:Description>
            <se:Title>Railways used for public transport</se:Title>
          </se:Description>
          <!--Parser Error: syntax error, unexpected COLUMN_REF, expecting $end - Expression was: Land use 2 = 'Railways used for public transport'-->
          <se:PointSymbolizer>
            <se:Graphic>
              <se:Mark>
                <se:WellKnownName>diamond</se:WellKnownName>
                <se:Fill>
                  <se:SvgParameter name="fill">#d7191c</se:SvgParameter>
                </se:Fill>
                <se:Stroke>
                  <se:SvgParameter name="stroke">#000000</se:SvgParameter>
                </se:Stroke>
              </se:Mark>
              <se:Size>3</se:Size>
            </se:Graphic>
          </se:PointSymbolizer>
        </se:Rule>
        <se:Rule>
          <se:Name>Residential buldings</se:Name>
          <se:Description>
            <se:Title>Residential buldings</se:Title>
          </se:Description>
          <!--Parser Error: syntax error, unexpected COLUMN_REF, expecting $end - Expression was: Land use 2 = 'Residential buldings'-->
          <se:PointSymbolizer>
            <se:Graphic>
              <se:Mark>
                <se:WellKnownName>diamond</se:WellKnownName>
                <se:Fill>
                  <se:SvgParameter name="fill">#fdae61</se:SvgParameter>
                </se:Fill>
                <se:Stroke>
                  <se:SvgParameter name="stroke">#000000</se:SvgParameter>
                </se:Stroke>
              </se:Mark>
              <se:Size>3</se:Size>
            </se:Graphic>
          </se:PointSymbolizer>
        </se:Rule>
        <se:Rule>
          <se:Name>Roads used for specific purposes of community services; dykes</se:Name>
          <se:Description>
            <se:Title>Roads used for specific purposes of community services; dykes</se:Title>
          </se:Description>
          <!--Parser Error: syntax error, unexpected COLUMN_REF, expecting $end - Expression was: Land use 2 = 'Roads used for specific purposes of community services; dykes'-->
          <se:PointSymbolizer>
            <se:Graphic>
              <se:Mark>
                <se:WellKnownName>diamond</se:WellKnownName>
                <se:Fill>
                  <se:SvgParameter name="fill">#ffffbf</se:SvgParameter>
                </se:Fill>
                <se:Stroke>
                  <se:SvgParameter name="stroke">#000000</se:SvgParameter>
                </se:Stroke>
              </se:Mark>
              <se:Size>3</se:Size>
            </se:Graphic>
          </se:PointSymbolizer>
        </se:Rule>
        <se:Rule>
          <se:Name>Tall buildings used for commercial purposes: garages, supermarkets, banks, stores, hotels, restaurants, offices</se:Name>
          <se:Description>
            <se:Title>Tall buildings used for commercial purposes: garages, supermarkets, banks, stores, hotels, restaurants, offices</se:Title>
          </se:Description>
          <!--Parser Error: syntax error, unexpected COLUMN_REF, expecting $end - Expression was: Land use 2 = 'Tall buildings used for commercial purposes: garages, supermarkets, banks, stores, hotels, restaurants, offices'-->
          <se:PointSymbolizer>
            <se:Graphic>
              <se:Mark>
                <se:WellKnownName>diamond</se:WellKnownName>
                <se:Fill>
                  <se:SvgParameter name="fill">#abd9e9</se:SvgParameter>
                </se:Fill>
                <se:Stroke>
                  <se:SvgParameter name="stroke">#000000</se:SvgParameter>
                </se:Stroke>
              </se:Mark>
              <se:Size>3</se:Size>
            </se:Graphic>
          </se:PointSymbolizer>
        </se:Rule>
        <se:Rule>
          <se:Name>Yards and parking areas of residential zones</se:Name>
          <se:Description>
            <se:Title>Yards and parking areas of residential zones</se:Title>
          </se:Description>
          <!--Parser Error: syntax error, unexpected COLUMN_REF, expecting $end - Expression was: Land use 2 = 'Yards and parking areas of residential zones'-->
          <se:PointSymbolizer>
            <se:Graphic>
              <se:Mark>
                <se:WellKnownName>diamond</se:WellKnownName>
                <se:Fill>
                  <se:SvgParameter name="fill">#2c7bb6</se:SvgParameter>
                </se:Fill>
                <se:Stroke>
                  <se:SvgParameter name="stroke">#000000</se:SvgParameter>
                </se:Stroke>
              </se:Mark>
              <se:Size>3</se:Size>
            </se:Graphic>
          </se:PointSymbolizer>
        </se:Rule>
      </se:FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>
  • 1
    what version of QGIS and GeoServer are you using? Also, have you checked the GeoServer logs for clues, and used the 'Validate' button on the Style Editor page? – Steven Kay Jun 23 '16 at 21:25
  • Also, there is no such a thing as a "diamond" well known name in the SLD or SE spec, and GeoServer does not have it among its custom symbols either. Try replacing it with "square" for example – Andrea Aime Jun 24 '16 at 8:54
2

look closely, and you'll see the problem, hiding in plain sight...

<!--Parser Error: syntax error, unexpected COLUMN_REF, expecting $end - Expression was: Land use 2 = 'Residential buldings'-->

I suspect you'll need to edit the SLD to rename the field name, e.g. "land_use_2". How you do this depends on the format you're importing from (shapefile, csv, postgres etc)

2

I export the SLD from QGIS 2.2 and I am running Geoserver 2.6. For the export from QGIS to work, I change the se:SvgParameter into sld:CssParameter.

Generally using SDL 1.0 instead of 1.1.0 prove to simplify some of the issues of transferring the symbology form QGIS to Geoserver in my case. But this will depend on the versions of the software you have. Additionally, as @Steven Kay explained there is an issue with that line, so fix this first.

PS: in that case, your code

<se:Name>Yards and parking areas of residential zones</se:Name>
          <se:Description>
            <se:Title>Yards and parking areas of residential zones</se:Title>
          </se:Description>

would look more like ( description tag not in sld 1.0 according to geoserver validator)

   <Name>Yards and parking areas of residential zones</Name>
   <Title>Yards and parking areas of residential zones</Title>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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