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

YSLD styling breaks Google Earth KML Output formats

    Details

      Description

      YSLD creates styling object with only the user supplied values. Here is an example where fill-color is provided:

      title: color-green
      symbolizers:
       - line:
          stroke-width: 2.0
          stroke-color: '#008000'
      - text:
          label: ${LineNumber}
          font-size: 8
          font-family: Arial Black
          font-style: normal
          fill-color: Black
      

      The KML Output formats were designed and tested with SLD 1.0 in mind (and assume the parser will fill in default values for anything not supplied by the user).

      As an example PlacemarkStyleDecorator assumes fill opacity is always defined:

                  if (fill != null) {
                      Double opacity = fill.getOpacity().evaluate(feature, Double.class);
                      if (opacity == null || Double.isNaN(opacity)) {
                          opacity = 1.0;
                      }
                      Color color = fill.getColor().evaluate(feature, Color.class);
                      ls.setColor(colorToHex(color, opacity));
                  } else {
                      ls.setColor("ffffffff");
                  }
      

      This code fails with a style produced by YSLD:

      Caused by: java.lang.NullPointerException
      	at org.geoserver.kml.decorator.PlacemarkStyleDecoratorFactory$PlacemarkStyleDecorator.setLabelStyle(PlacemarkStyleDecoratorFactory.java:290)
      	at org.geoserver.kml.decorator.PlacemarkStyleDecoratorFactory$PlacemarkStyleDecorator.decorate(PlacemarkStyleDecoratorFactory.java:115)
      	at org.geoserver.kml.sequence.FeatureSequenceFactory$FeatureGenerator.next(FeatureSequenceFactory.java:137)
      

        Attachments

          Issue links

            Activity

              People

              • Assignee:
                jody.garnett Jody Garnett
                Reporter:
                jody.garnett Jody Garnett
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: