NieuwlandGeo/SLDReader

Request: Point Symbolizer changes to improve QGIS support

richard-thomas opened this issue · 1 comments

I include a code suggestion below to improve Point Symbolizer support in function getWellKnownSymbol() for QGIS (3.18). Changes are:

  • adding 'cross2' as an alias for 'x' (goodness knows why QGIS calls it that instead of SLD standard 'x'!)
  • adding 'diamond'
  • modifying octagon default angle so it is flat at top/bottom rather than pointed (both to match QGIS and to be generally a more useful default)
      case 'octagon':
        return new style.RegularShape({
          angle: Math.PI / 8,
          fill: fill,
          points: 8,
          radius: radius,
          stroke:
            stroke ||
            new style.Stroke({
              color: fillColor,
              width: radius / 2,
            }),
          rotation: rotationRadians,
        });

      case 'cross2':
      case 'x':
        return new style.RegularShape({
          angle: Math.PI / 4,
          fill: fill,
          points: 4,
          radius1: radius,
          radius2: 0,
          stroke:
            stroke ||
            new style.Stroke({
              color: fillColor,
              width: radius / 2,
            }),
          rotation: rotationRadians,
        });

      case 'diamond':
        return new style.RegularShape({
          angle: 0,
          fill: fill,
          points: 4,
          radius1: radius,
          stroke: stroke,
          rotation: rotationRadians,
        });

I added this in PR #93