-Jepsg where epsg is an UTM with negative longitudes fails in classic but only for .ps in modern.

Open
#7,773 3 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
c

Research direction

Reproduce the modern gmt coast EPSG:32618 commands and the classic gmt pscoast -JU18/14c command, comparing .ps with other output formats. Start with gmtproj_utm() and its call from gmt_geo_to_xy, then inspect how the GDAL UTM transformation is used; done means the negative-longitude, southern-hemisphere case renders consistently instead of producing a blank or off-page figure.

Written by the indexing model from the issue text.

Description

bug

The modern case first.
This fails. No PS error but figure is blank

gmt coast  -R-81.8/-66.9/-1.0/15.0 -J32618 -Baf -BWSen -W0.5 -Da -ps lixo

but this, or any other format, works.

gmt coast  -R-81.8/-66.9/-1.0/15.0 -J32618 -Baf -BWSen -W0.5 -Da -eps lixo

Now the classic mode case. Since here we only have output in .ps it always fails. But using the -J GMT syntax, works.
That is, this works. (epsg:32618 <==> JU18)

gmt pscoast  -R-81.8/-66.9/-1.0/15.0 -JU18/14c -Baf -BWSen -W0.5 -Da -P > lixo.ps

Several debugging hours later I found why. The gmtproj_utm() function (called by gmt_geo_to_xy) has

if (!GMT->current.proj.north_pole) (*y) += GMT_FALSE_NORTHING;	/* For S hemisphere, add 10^7 m */

but the corresponding GDAL function that is used for the UTM transformation doesn't have that offset and thus the computed ps units are negative and points fall off cliff.

So, one of the problems is identified though I don't know a cure since the transformation for the epsg case takes place inside the GDAL lib.

The second problem is: HTF the modern mode is insensitive to problem one when not using the .ps format????

Dominant language
C
Stars
997
Forks
420
Avg merge
13h 27m
Merged PRs (30d)
47

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from GenericMappingTools/gmt

All issues in GenericMappingTools/gmt

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.