Skip to content

Add the Equal Earth projection support following what was done for Spilhaus - #9199

Merged
joa-quim merged 4 commits into
masterfrom
equal-earth
Sep 13, 2026
Merged

Add the Equal Earth projection support following what was done for Spilhaus#9199
joa-quim merged 4 commits into
masterfrom
equal-earth

Conversation

@joa-quim

Copy link
Copy Markdown
Member

Number of line changes are surprisingly small.

  • src/gmt_project.h — GMT_PROJ4_EQEARTH added to the 500-block enum.
  • src/gmt_init.c — detect eqearth in the PROJ string; also gmt_set_geographic(GMT_IN). gmtinit_parse_J_option is never called for PROJ-only projections, so a non-global -R-100/40/-20/70 was read as Cartesian and all annotations vanished.
  • src/gmt_proj.c (+52) —
    • gmtproj_proj4_pcyl_fwd/_inv: GDAL normalizes geographic lon to [-180,180] before subtracting lon_0, so with -Rg +lon_0=180 both W and E boundaries collapsed onto the west edge. Wind relative to central meridian, nudge the antimeridian GMT_PROJ_CONV_LIMIT inside.
    • gmtproj_left/right_proj4_pcyl: curved W/E edges. No analytic formula, so invert (origin[GMT_X], y) → lat, then project (west|east, lat).
  • src/gmt_map.c — map_init_proj4: central meridian from +lon_0, is_world, curved edges, parallel_straight, GMT_OBL_ANNOT_NORMAL_TICKS, and projection_GMT = projection (the frame/annotation switches all test projection_GMT, which stays GMT_NO_PROJ otherwise — that was the Bad case in gmt_map_clip_path (500)). Clip path + gmt_half_map_width get the Robinson treatment.
  • src/gmt_plot.c — boundary → gmtplot_basic_map_boundary; added to the proj_A list (annotate both 0 and 360).

It contains also a test/psbasemap/eqearth.sh that will break the CI because the baseline ps missing.

Can be tested tested with:

gmt coast -Rd -W0.5 -Bag -J+proj=eqearth+width=15 -png lixo
lixo

Assisted-by: Claude Opus 5.0

…ilhaus.

Number of line changes are surprisingly small.

- src/gmt_project.h — GMT_PROJ4_EQEARTH added to the 500-block enum.
- src/gmt_init.c — detect eqearth in the PROJ string; also gmt_set_geographic(GMT_IN). gmtinit_parse_J_option is never called for PROJ-only projections, so a non-global -R-100/40/-20/70 was read as Cartesian and all annotations vanished.
- src/gmt_proj.c (+52) —
  - gmtproj_proj4_pcyl_fwd/_inv: GDAL normalizes geographic lon to [-180,180] before subtracting lon_0, so with -Rg +lon_0=180 both W and E boundaries collapsed onto the west edge. Wind relative to central meridian, nudge the antimeridian GMT_PROJ_CONV_LIMIT inside.
  - gmtproj_left/right_proj4_pcyl: curved W/E edges. No analytic formula, so invert (origin[GMT_X], y) → lat, then project (west|east, lat).
- src/gmt_map.c — map_init_proj4: central meridian from +lon_0, is_world, curved edges, parallel_straight, GMT_OBL_ANNOT_NORMAL_TICKS, and projection_GMT = projection (the frame/annotation switches all test projection_GMT, which stays GMT_NO_PROJ otherwise — that was the Bad case in gmt_map_clip_path (500)). Clip path + gmt_half_map_width get the Robinson treatment.
- src/gmt_plot.c — boundary → gmtplot_basic_map_boundary; added to the proj_A list (annotate both 0 and 360).

Assisted-by: Claude Opus 5.0
@joa-quim
joa-quim requested a review from a team September 11, 2026 17:09
@Esteban82 Esteban82 assigned Esteban82 and unassigned Esteban82 Sep 11, 2026
@Esteban82 Esteban82 added the add-changelog Add PR to the changelog label Sep 11, 2026
@Esteban82
Esteban82 self-requested a review September 11, 2026 17:17

@Esteban82 Esteban82 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works for me. I got the same figure.

@Esteban82 Esteban82 added the enhancement Improving an existing feature label Sep 11, 2026
@anbj

anbj commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Wasn’t this projection supported in GMT before?! I thought it was quite common..

@joa-quim

Copy link
Copy Markdown
Member Author

No, it wasn't. This Guardian article brings some context. But this won't go without me saying that I find that article particularly ... silly. IMO, the Mercator projection is (was) the most important map projection to humanity as it gave the ability to sailing through oceans with a map and a compass (and a sextant). There is nothing colonial in that. UTM was colonial (created to draw the Pink-Rose maps).

@github-actions

github-actions Bot commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Summary of changed images

This is an auto-generated report of images that have changed on the DVC remote

Status Path
added test/baseline/psbasemap/eqearth.ps
modified test/baseline/psbasemap/

Image diff(s)

Details

Added images

  • test/baseline/psbasemap/eqearth.png

Modified images

Path Old New

Report last updated at commit 3f0a231

@joa-quim
joa-quim merged commit 80b5c1d into master Sep 13, 2026
15 of 18 checks passed
@joa-quim
joa-quim deleted the equal-earth branch September 13, 2026 10:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

add-changelog Add PR to the changelog enhancement Improving an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants