Bug #651

psxy -Sql breaks polygon plotting

Added by Kristof almost 3 years ago. Updated almost 3 years ago.

Status:ClosedStart date:2014-11-27
Priority:NormalDue date:
Assignee:Paul% Done:

0%

Category:-
Target version:Candidate for next bugfix release
Affected version:5.2-svn Platform:

Description

Based on my forum post: psxy: add a label and things go wrong?

Plotting a polygon from a list of coordinates causes reliably reproducible artifacts when labels are added. This seems to be independent from projection type. I tested it with -JL (Lambert conic conformal projection) and -JM (Mercator projection). For illustrating purposes I attached a bare bones test script.

OBSERVED BEHAVIOR

A connecting line is plotted between the two points where the polygon crosses the plots boundary. In the image below, the diagonal line running from the upper to the right border appears only when a label via -Sql is placed. When the option is omitted, the polygon is plotted as desired (only the vertical and the horizontal part of the red polygon).

cropped and resized screenshot of artifact

EXPECTED BEHAVIOR

The usage of the -Sql option should not alter the shape of the polygon to be plotted.

STEPS TO REPRODUCE

After some experimenting I boiled the requirements down to:

  • closed polygon (first & last coordinate identical)
  • polygon only partly in plot area
  • joint of polygon inside plot area
  • label added with -Sql

This reliably reproduces the line artifacts on the polygon. If the label is omitted, the polygon gets plotted correctly.

In the test script attached below:

  • The polygons on the left (blue & green) have their joint outside the plot.
  • The polygons on the right (red & brown) have their joint inside the plot.

Please note the upper right red polygon failing.

SYSTEM

GMT Version 5.2.0_r13750 [64-bit] [4 cores]
Ubuntu 12.04.5 LTS (GNU/Linux 2.6.32-042stab094.7 x86_64)


Hopefully this gives you enough information for hunting down the bug. As my bugs become quickly fixed and my questions are patiently answered I'd like to say thank you for your work on the GMT collection. Gentlemen, you rock!

All the best,
Kristof

screenshot_1.png - cropped and resized screenshot of artifact (19.4 KB) Kristof, 2014-11-27 11:33

psxy_label_test.pdf - test script output (4.94 KB) Kristof, 2014-11-27 13:15

psxy_label_test.sh Magnifier - simple test script highlighting the problem (1.32 KB) Kristof, 2014-11-27 13:15

psxy_label_test.ps - test script output (33.2 KB) Kristof, 2014-11-27 13:15

Associated revisions

Revision 13772
Added by Paul almost 3 years ago

Address limitation highlighted by issue #651

History

#1 Updated by Paul almost 3 years ago

  • Status changed from New to Resolved
  • Assignee set to Paul
  • Target version set to Candidate for next bugfix release

The quote line machinery did not check if clipping caused the original line to be chopped into 2 or more pieces. I have added code to handle that; please see if it works for you as well. In r13773.

#2 Updated by Paul almost 3 years ago

Your example highlighted an ugly blight in GMT: When a polygon is clipped it sometimes is returned as two individual line segments that actually share a common point, yet plotting them separately can give an ugly notch at the joint point if there is an angle there (as in your case). I have implemented a solution that shuffles such two segments into order and thus yields a single line. Have a look at your case now, In r13775.

#3 Updated by Kristof almost 3 years ago

Hi Paul,

thank you for your fix. Works for me in r13841 Thank you and happy holidays!

All the best,
Kristof

#4 Updated by Paul almost 3 years ago

  • Status changed from Resolved to Closed

I am closing this as fixed.

Also available in: Atom PDF