gmtspatial polygon clipping artifacts
|Target version:||Candidate for next minor release|
I just discovered the nice tool gmtspacial, which is very useful to clip polygons to your map boundaries but with some polygons I get unexpected results, messing up the whole process. I've attached two files, the input and the output of the following command:
gmtspatial -C -R65.000/120.000/-80.500/-65.00 cst10_polygon.shelf.org.lb > cst10_polygon.shelf.clipped.lb
The first polygon is cut at the map boundary as expected.
For the second polygon (which is obviously far away from the area) the segment header and the first point is written to the output, which is not critical, but also not nice because it means a lot of unneccessary data.
The third polygon which is also far away from my region however produces a strange artifact. Here a polygon is created which crosses the whole map and makes the resulting image unusable.
I'm using GMT SVN Version 5.1.3_r14870 [64-bit] on Ubuntu 14.04.
Thanks for your help
#2 Updated by Ludwig about 6 years ago
I tried but it changes nothing. As it can be seen at the second polygon, where the first point is rewritten as '234.669528215 -73.5795590559' (originally '-125.330471785 -73.5795590559') shows, that it is already treated as geographical.
Also my first idea was that this is a dateline problem, but the polygon actually leading to the artifact isn't crossing the dateline.
#3 Updated by Paul almost 6 years ago
- Status changed from Feedback to Resolved
- Assignee set to Paul
- Target version set to Candidate for next minor release
- % Done changed from 0 to 100
I found the problems. One was gmtspatial did not actually act on the -fg in this case, and two was the clipping algorithm got confused when a feature straddled the meridian 180-degrees away from either of the two boundaries. In r14943 [GMT 5.2 only - we will release 5.2 next month but you can build from source now if you want].