Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Interrupted Mollweide (land and ocean view) projections #3139

Merged
merged 4 commits into from
Mar 28, 2022

Conversation

erykoff
Copy link
Contributor

@erykoff erykoff commented Mar 25, 2022

This PR is in response to #3122.

I've recently been trying to learn about various map projections and how PROJ works, and this seemed like an interesting exercise. In this case I went back to read the original Goode (1919) paper which introduced the Interrupted Homolographic Projection (his name for the Interrupted Mollweide Projection) and the Goode (1925) paper which introduced the Interrupted Goode Homolosine Projection (combining Mollweide at high latitude with Sinusoidal at low latitude). I agree with the oceanographers (such as @lukegre) who think that Goode's original trade-off of equatorial distortion for a discontiguous derivative at +/-40°44'11.8" is not the best aesthetic choice, particularly for the Oceanic View.

One thing I should note is that the built-in plotting code for the proj documentation does not do a very good job of rendering interrupted projections. Attached please find examples of the new Interrupted Mollweide (imoll) and Interrupted Mollweide Oceanic View (imoll_o) projections as rendered by proj+pyproj+cartopy.
imoll
imoll_o

The code here is adapted from the igh.cpp and igh_o.cpp source files, keeping to the same style.

@kbevers
Copy link
Member

kbevers commented Mar 26, 2022

Great addition. For now just a review concerning the docs.

projections as rendered by proj+pyproj+cartopy

Do you have some examples? It might be time to give the figures and overhaul.

I'd like you to add some more information in the two doc pages. I learned more from reading your PR text than the doc pages. Put some of the information you've written here in the docs. Also, I see that you reference the original paper in the code. This also needs to be referenced in the docs (see https://github.com/OSGeo/PROJ/blob/master/docs/source/references.bib).

@erykoff
Copy link
Contributor Author

erykoff commented Mar 26, 2022

I made some modifications to the plotting code on this PR to handle interrupted projections, so that continents and graticules don't extend over the interruption regions. If you prefer I could pull that out into a separate PR, but I was already working on this branch. The only projections directly affected by the changes are the new Interrupted Mollweide; the Interrupted Goode Homolosine; and the Icosahedral Snyder Equal Area. The healpix documentation maps are also incorrect, but they must have been built outside of PROJ.

For example, the old igh.png is:
igh_old
And the new one on this PR is:
igh

I also added Goode (1919) and (1925) to the bibliography, and expanded the documentation for the Interrupted Goode Homolosine and Interrupted Mollweide projections.

@kbevers
Copy link
Member

kbevers commented Mar 27, 2022

If you prefer I could pull that out into a separate PR, but I was already working on this branch.

Yeah, I think that would be better.

I made some modifications to the plotting code on this PR to handle interrupted projections, so that continents and graticules don't extend over the interruption regions.

Wow! This is awesome. Very happy to see this, I never figured out how to do this when I wrote the plotting code back in the day. One of the shortcuts I did back then was to not fill in the continents with black since it absolutely screwed up the image. The alternative was slightly better (i.e. you could make out the projection but had the criss-crossing lines). I wonder if this change will fix that as well? If it does it would be great to have the continents filled in with black as the rest of the figures in the docs.

I realize this might not be a fix to everything but we do have some figures that could be improved. Again I'm wondering if this change can make a difference but its worth a try. I went trough all the figures and this is a list of candidates for improvement:

  • aeqd: weird graticule around the northern hemisphere
  • bipc: graticule between continents looks weird
  • imw_p: Not sure about this one but it doesn't look great. Mainly because of the equator graticule line going very wide.
  • lsat: A bunch of excess horisontal lines drawn between the poles
  • misrsom: Similar to lsat
  • ob_tran: This could just be the choice of projections, but at least in this example something funky is happening in the top of the figure (north america).
  • omerc: Vertical lines are drawn from in the right side of the figure
  • gstmerc: Mostly vertical lines from top to bottom but also the outer graticule lines could probably be trimmed a bit
  • tcea: Vertical lines in the right side of the figure

@erykoff
Copy link
Contributor Author

erykoff commented Mar 27, 2022

Okay, I'll make a new PR with plotting improvements, cherry-picking the plotting commits from this branch, and I'll take a look at the other problematic figures.

As for filling in the continents, the trick that I did here with the lines (which I figured out when developing skyproj) isn't trivially extended to filling in the polygons except for the simplest cases. In particular, Antarctica is split into multiple regions in igh, and continents such as South America are half-split in the igh oceanic view. I have a couple ideas on how to make this work, but if it looks like it's getting too complicated, I'd rather leave the relatively simple plotting tool, just improved so that the lines don't go crazy.

@kbevers
Copy link
Member

kbevers commented Mar 27, 2022

Okay, I'll make a new PR with plotting improvements, cherry-picking the plotting commits from this branch, and I'll take a look at the other problematic figures.

Sounds good, very much appreciated!

I have a couple ideas on how to make this work, but if it looks like it's getting too complicated, I'd rather leave the relatively simple plotting tool, just improved so that the lines don't go crazy.

Don't spend too much time on making that work, it's already a great improvement.

@erykoff
Copy link
Contributor Author

erykoff commented Mar 27, 2022

Yeah, I spent a few minutes looking at it and have come to the conclusion that it's not a quick fix.

However, I do have some good news. I was looking at the problem with the ob_tran plot and realized that (a) there's a typo (imill instead of imoll); (b) I didn't realize this rotation transformation existed, and it is precisely what I was looking for for skyproj; (c) when fixing the typo the rendering shows as intended:
ob_tran

I'll have this fixed on the new PR.

@erykoff
Copy link
Contributor Author

erykoff commented Mar 28, 2022

See #3144 .

@kbevers
Copy link
Member

kbevers commented Mar 28, 2022

With #3144 merged this needs to be rebased off of it. Otherwise I think it is good to go!

@kbevers
Copy link
Member

kbevers commented Mar 28, 2022

Otherwise I think it is good to go!

Almost at least. I just noticed a minor detail of the graticule in the imoll plot, that I think is just a matter of tweaking the parameters. Here's a snippet that highlights the issue:

Screen Shot 2022-03-28 at 17 41 57

@erykoff
Copy link
Contributor Author

erykoff commented Mar 28, 2022

Ah yes! I spent so much time tweaking the (more challenging) imoll_o plot that I didn't notice that.

@erykoff
Copy link
Contributor Author

erykoff commented Mar 28, 2022

Oof. Turns out that because of the simplified plotting options that I made, I can't get the lines to disappear without messing up the continents (particularly South America):
image
Options are ... (a) leave it as is; (b) fix the graticules and make the continents uglier; (c) edit the plotting code, but this would make it more complicated.

@kbevers
Copy link
Member

kbevers commented Mar 28, 2022

Options are ... (a) leave it as is; (b) fix the graticules and make the continents uglier; (c) edit the plotting code, but this would make it more complicated.

Go with (a), it is barely noticeable. If you feel like it a a later stage you can always come back and do (c).

@erykoff
Copy link
Contributor Author

erykoff commented Mar 28, 2022

Let me know if there's anything else that needs to be changed here, but I think it's in good shape (and passes tests).

@kbevers kbevers merged commit c03a3c3 into OSGeo:master Mar 28, 2022
@kbevers kbevers added this to the 9.1.0 milestone Mar 28, 2022
@kbevers
Copy link
Member

kbevers commented Mar 28, 2022

Let me know if there's anything else that needs to be changed here, but I think it's in good shape (and passes tests).

It looks very good and is absolutely fit for merging. Thanks for the contributions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Interrupted Mollweide projection
2 participants