Uploaded image for project: 'GeoServer'
  1. GEOS-8034

YSLD ColorMap incorrectly recording a String (as shown in SLD conversion)

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: 2.10.0
    • Fix Version/s: 2.11.4, 2.12.1, 2.13-beta
    • Component/s: REST, YSLD
    • Labels:
      None
    • Environment:

      Description

      We are using Geoserver REST API to upload and attach yaml style files to layers. A sample yaml file looks like this:

      name:  Test
      title: Test Style title
      abstract: Styling of Test layer
      feature-styles:
      - rules:
        - title: raster
          symbolizers:
            - raster:
                opacity: 1.0
                color-map:
                  type: values
                  entries:
                  - ['#e20374', 1.0, 1, Lorem Ipsum (magenta = covered)]
      

      We use the following curl commands to upload the style:

       
      Creating Style
      curl -u "$credentials" -XPOST -H "Content-type: text/xml" -d "<style><name>$style_name</name><format>ysld</format><filename>$style_name.yaml</filename><languageVersion><version>1.0.0</version></languageVersion></style>" http://host:8081/geoserver/rest/workspaces/$workspace_name/styles
       

      Update the style with uploaded style info

              curl -u $credentials -XPUT -H "Content-type: application/vnd.geoserver.ysld+yaml" --data-binary @$style_name.yaml http:// host:8081/geoserver/rest/workspaces/$workspace_name/styles/$style_name 
       

      Check result:

              curl -u $credentials -XGET http:// host:8081/geoserver/rest/workspaces/$workspace_name/styles/$style_name.sld?pretty=true  
       
      <?xml version="1.0" encoding="UTF-8"?>
      <sld:StyledLayerDescriptor xmlns="http://www.opengis.net/sld" xmlns:sld="http://www.opengis.net/sld" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" version="1.0.0">
          <sld:NamedLayer>
              <sld:Name>test</sld:Name>
              <sld:UserStyle>
                  <sld:Name>Test</sld:Name>
                  <sld:Title>Test Style</sld:Title>
                  <sld:Abstract>Styling abstract desc.</sld:Abstract>
                  <sld:FeatureTypeStyle>
                      <sld:Rule>
                          <sld:Title>raster</sld:Title>
                          <sld:RasterSymbolizer>
                              <sld:ColorMap type="values"> 
                              <sld:ColorMapEntry color="*{color:red}java.awt.Color[r=226,g=3,b=116]{color}*" opacity="1.0" quantity="1" label="lorem ipsum (magenta = covered)"/>
                              </sld:ColorMapEntry>
                              <sld:ContrastEnhancement/>
                              </sld:RasterSymbolizer>
                      </sld:Rule>
                  </sld:FeatureTypeStyle>
              </sld:UserStyle>
          </sld:NamedLayer>
      </sld:StyledLayerDescriptor>
      

      As can be seen, #e20374 is converted to java.awt.Color instead of the same '#e20374' literal. When I manually edit the yaml file in geoserver (i.e replace java.awt.Color[r=226,g=3,b=116] with #e20374) , I get the correct styling.

      However, if I use the the java color ( java.awt.Color[r=226,g=3,b=116]), I get the following error:

      Null; Invalid color, must be one of '#RRGGBB', rgb(r,g,b), or expression: in 'reader' line 14, column 14:- java.awt.Color[r=226,g=3,b=116] ...

      It seems that something goes wrong during conversion.

        Attachments

          Activity

            People

            • Assignee:
              ksmith Kevin Smith [Administrator]
              Reporter:
              algone M. Gone
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: