GeoTools
  1. GeoTools
  2. GEOT-3912

PerpendicularOffset for LineSymbolizer unsupported; Bounty for render support

    Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Incomplete
    • Affects Version/s: 2.7.4, 8.0-M2, 8.0-M3
    • Fix Version/s: 8.8
    • Component/s: main, render
    • Labels:
      None
    • Testcase included:
      yes

      Description

      SE 1.1 describes the possibility to set a PerpendicularOffset for a LineSymbolizer, just like SLD 1.0 does for the LinePlacement. I know that GeoTools is not a reference implementation for SE 1.1, but I know about AtlasStyler users that desire such a function.

      In trunk the LineSymbolizer class has a setter and a getter for PerpendicularOffset, but the settings is lost when transforming the Style to and from XML, as well it is lost when the Style is duplicated with the DuplicatingStyleVisitor.

      Attached are two patches:
      1. Two unit tests showing that LineSymbolizer.set/getPerpendicular settings are lost when transforming/parsing/duplicating the Style.
      2. A patch fixing the three cases above

      The patches are created again '/trunk/modules/library/main'

      What's missing is the implementation in the renderer, as shortly discussed here:
      http://www.mail-archive.com/geotools-gt2-users@lists.sourceforge.net/msg13087.html

      My symbolic offer for funding the renderer-implementation: I sponser this implementation with 200€ via paypal. I will send the money to any email chosen by the one that implements this in the renderer; or I can donate it to any organization of choice. I will not need any bills, as I fund this privately. In case anybody is willing, please tell me before you start via email

      I would be very happy if I could commit the above patches and anybody would take the bounty.

      Steve

      1. perpendicularOffsetImplementation.patch
        3 kB
        Stefan Alfons Tzeggai
      2. perpendicularOffsetTests.patch
        3 kB
        Stefan Alfons Tzeggai
      3. perpoff.diff
        6 kB
        Björn Harrtell
      4. perpoffTest.diff
        5 kB
        Björn Harrtell
      1. narrowbug.png
        2 kB
      2. perpoff.png
        1 kB
      3. perpoff.png
        24 kB

        Activity

        Hide
        Martin Davis added a comment -
        The offset code in the patch is using the JTS OffsetCurveBuilder class. This class is used internally in the JTS buffer code to produce *raw* offset curves for buffers. It's not intended for standalone use. It produces ugly linework when there are inside turns which are "narrower" than the offset distance. So I don't think this is suitable for production rendering use, since the failure cases are going to be very obvious when they occur.

        On the positive side, since this is not derived from the single-sided buffer code, it will actually work with self-intersecting lines. It doesn't produce closed offset lines for rings, though.

        As Andrea observes, this is a tough problem. I've been playing around with a JTS implementation in the lab, but it's not ready for production, and has some blocking issues.
        Show
        Martin Davis added a comment - The offset code in the patch is using the JTS OffsetCurveBuilder class. This class is used internally in the JTS buffer code to produce *raw* offset curves for buffers. It's not intended for standalone use. It produces ugly linework when there are inside turns which are "narrower" than the offset distance. So I don't think this is suitable for production rendering use, since the failure cases are going to be very obvious when they occur. On the positive side, since this is not derived from the single-sided buffer code, it will actually work with self-intersecting lines. It doesn't produce closed offset lines for rings, though. As Andrea observes, this is a tough problem. I've been playing around with a JTS implementation in the lab, but it's not ready for production, and has some blocking issues.
        Hide
        Björn Harrtell added a comment -
        Understandably this is not an ideal implementation, but it works quite well if you avoid the narrow inside turns that Martin mentioned.

        Test case is running the symbolizer for visual inspection. Are buffer pixel tests desired? (can't find any preexisiting tests that goes that far)
        Show
        Björn Harrtell added a comment - Understandably this is not an ideal implementation, but it works quite well if you avoid the narrow inside turns that Martin mentioned. Test case is running the symbolizer for visual inspection. Are buffer pixel tests desired? (can't find any preexisiting tests that goes that far)
        Hide
        Andrea Aime added a comment -
        I believe we need to take a decision on whether a known to be buggy implementation is better than no implementation, given that there is no correct implementation in sight. The community has to make this call, Bjorn, can you send a mail to geotools-devel describing the issue?
        It would be great to show images of both acceptable behavior and buggy one.
        Show
        Andrea Aime added a comment - I believe we need to take a decision on whether a known to be buggy implementation is better than no implementation, given that there is no correct implementation in sight. The community has to make this call, Bjorn, can you send a mail to geotools-devel describing the issue? It would be great to show images of both acceptable behavior and buggy one.
        Hide
        Björn Harrtell added a comment - - edited
        Adding two images, one with acceptable result and one showing a bugged case. I'll post a message to the list asap.
        Show
        Björn Harrtell added a comment - - edited Adding two images, one with acceptable result and one showing a bugged case. I'll post a message to the list asap.
        Hide
        Martin Davis added a comment -
        Bjorn, have you tried a realistic natural feature with a relatively large offset? That's a situation where the raw offset curve generation will exhibit some really ugly artifacts.
        Show
        Martin Davis added a comment - Bjorn, have you tried a realistic natural feature with a relatively large offset? That's a situation where the raw offset curve generation will exhibit some really ugly artifacts.

          People

          • Assignee:
            Andrea Aime
            Reporter:
            Stefan Alfons Tzeggai
          • Votes:
            2 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: