Opened 15 years ago

Closed 13 years ago

#3165 closed defect (fixed)

AGG Rendering Error at Polygon Edges

Reported by: rbranson Owned by: tbonfort
Priority: normal Milestone: 6.2 release
Component: AGG Version: 5.6
Severity: normal Keywords:
Cc:

Description

There appears to be an error in the way that AGG is rendering polygons that are next to one another. I know there have been other tickets opened for this, but none are open and this problem appears to continue to happen. I've tested this in both 5.4 releases as well as the latest 5.6-beta3 release. This visual error does not occur when the GD renderer is used. You'll find an attached copy of the same area rendered with the GD renderer and the AGG renderer on the exact same mapfile and data. The company I work for is willing to sponsor the development of a fix for this error that would be released back into the MapServer trunk.

Attachments (4)

agg_renderer.png (33.4 KB ) - added by rbranson 15 years ago.
AGG Rendered File
gd_renderer.png (13.8 KB ) - added by rbranson 15 years ago.
GD Rendered Image
poly.patch (1.7 KB ) - added by tbonfort 15 years ago.
patch to remove polygon simplification
missing_islands.png (20.7 KB ) - added by rbranson 15 years ago.

Download all attachments as: .zip

Change History (15)

by rbranson, 15 years ago

Attachment: agg_renderer.png added

AGG Rendered File

by rbranson, 15 years ago

Attachment: gd_renderer.png added

GD Rendered Image

comment:1 by tbonfort, 15 years ago

can you provide a test case that reproduces this behavior (ideally data + mapfile + request that triggers the bug)

thanks

comment:2 by tbonfort, 15 years ago

are the images you show a screenshot of openlayers rendering tiles, or is this a single generated image ?

please also post a mapfile excerpt of the layer showng this

in reply to:  2 comment:3 by rbranson, 15 years ago

Replying to tbonfort:

are the images you show a screenshot of openlayers rendering tiles, or is this a single generated image ?

please also post a mapfile excerpt of the layer showng this

I am still working on getting sample data extracted that reproduces the bug. It's a rather large (copyrighted) data set. It is from a single generated image requested from mapserver. What I posted is the actual file output directly from the mapserv CGI.

LAYER

NAME ocean_mask DATA "intl/world_oceans.shp" TYPE POLYGON STATUS ON GROUP base

CLASS

STYLE

COLOR 204 229 255

END

END

END

comment:4 by tbonfort, 15 years ago

If you'd like, you can mail me the info to get the full dataset, I'll promise to only use for debugging this issue and will delete after that => thomas dot bonfort at gmail dot com

comment:5 by tbonfort, 15 years ago

  • the dataset contains many invalid geometries, but that doesn't seem to be the problem here
  • the vertical artifact comes from the fact that mapserver does some polygon simplifications that does not conserve topology. I'm attaching a patch that removes this behavior, I'm not yet quite sure what should be done with this ( remove simplification for polygon shapes, or have the user decide to apply simplification via a processing keyword. Steve: would you like to comment on this?)
  • seeing how the shapes are organised, there remains a faint outline(the horizontal one) that is due to how agg renders polygons. To overcome this you can add an outlinecolor and outlinewidth 0.2 to your style blocks

by tbonfort, 15 years ago

Attachment: poly.patch added

patch to remove polygon simplification

comment:6 by tbonfort, 15 years ago

Cc: sdlime added
Milestone: 6.0 release
Status: newassigned

in reply to:  5 comment:7 by rbranson, 15 years ago

Replying to tbonfort:

  • the dataset contains many invalid geometries, but that doesn't seem to be the problem here
  • the vertical artifact comes from the fact that mapserver does some polygon simplifications that does not conserve topology. I'm attaching a patch that removes this behavior, I'm not yet quite sure what should be done with this ( remove simplification for polygon shapes, or have the user decide to apply simplification via a processing keyword. Steve: would you like to comment on this?)

Thomas -- thanks a bunch! I am going to test the patch here.

  • seeing how the shapes are organised, there remains a faint outline(the horizontal one) that is due to how agg renders polygons. To overcome this you can add an outlinecolor and outlinewidth 0.2 to your style blocks

Do you think that this issue will ever be addressed? I've looked thru some of the source and realize it'd require a pretty serious reorganization of how the AGG renderer is used.

comment:8 by rbranson, 15 years ago

I can verify that the patch successfully fixes the simplification problem. Thank you! The issue with using an outline is that it really lowers the definition of the geography on the map. Even set to 0.01 (I'm sure there is some effective minimum far above this), many of the islands in our screenshot disappear. I've attached a screenshot (from the patched trunk with OUTLINEWIDTH 0.01 [0.2 yields the same] and a matching OUTLINECOLOR) to compare with the previous.

by rbranson, 15 years ago

Attachment: missing_islands.png added

comment:9 by rbranson, 14 years ago

Milestone: 6.0 release5.6.1 release
Version: 5.45.6

Any reason this can't be moved to a 5.6 patch release?

comment:10 by tbonfort, 13 years ago

Cc: sdlime removed
Milestone: 5.6.1 release6.2 release

The code is in place with the new rendering api to be able to select, layer by layer, which simplification method should be used, but it cannot yet be activated by a user from the mapfile. Pushing to a future version as we're too late into the beta to add this functionality.

By default, the simplification would occur as it provides substantial rendering speedups when the resolution of the data is high compared to the resolution of the rendered map.

As for the problem with contiguous polygons, there is still no simple solution. I know there have been tests made to tweek gamma that minimizes this effect, which leads to better results than adding an outline, but still reduces the perceived resolution for non-contiguous polygons. rbranson, please contact me offlist if you still have funding for this and would like to investigate into this solution for the next version.

comment:11 by tbonfort, 13 years ago

Resolution: fixed
Status: assignedclosed

Linear gamma correction added in r11956, doc updated in r11957

Note: See TracTickets for help on using tickets.