-
Notifications
You must be signed in to change notification settings - Fork 806
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
Error in Bertin1953? #1579
Comments
Looks like you're right — how did I not see that mistake? 😱6b0567b#diff-31a3d34b36547f14e56143393932f3efR71 Here's a drawing that shows what the correct version should be: The following shows what you would get with the incorrect code: (I think my problem when I ported the JS code to CPP is that I am struggling to draw with PROJ.) How can we fix — and test — this? |
Seems like you've already made fix. Submit it in a pull request. As part of the pull request it would be great to have the figure in the docs updated also, so that the projection is displayed correctedly. Here is the current version: https://proj.org/operations/projections/bertin1953.html You can update the figures by running the There's a conda environment file in the plot folder which can be used to set up a suitable environment for building the plots. It is a bit old so some packages may need to be updated but it shouldn't be too difficult to figure out. Making the plot is a fairly good sanity test of the projection. Ideally we would also want some test coordinates in a |
I submitted PR #1582 to take care of the code issue. Someone else will have to handle updating any figure in the docs, etc. I only ran into this while trying to Implement the Bertin 1953 in Java. I found the PROJ implementation easier to read than the d3-geo version, but eventually realized that there must be a bug in the PROJ code. |
Thanks! I've tried to follow @kbevers' procedure, but I'm stuck at compilation. |
@Fil Can I use the image above in the PROJ docs? The script I normally use to generate projection examples with does not cope with this projection very well. |
Yes, of course! Thank you
|
Thanks :-) |
Northern hemisphere "warp" implemented incorrectly. See #1579
@rschmunk I just tried the G.Projector version, thanks for porting and including this projection! I couldn't find the source code but read BertinRiviere.class with a decompiler (https://gist.github.com/Fil/c8e32c202918bdf462b45adc01867d8d) The inverse function is interesting. I had written one at some point but was not happy with it and didn't add it to D3 — I'll give it another shot. |
Nice decompilation! Sorry about the lack of on-line source code, but I could have provided if you'd sent e-mail about it. |
The final "north warp" at lines 69-71 in the Bertin1953 projection code has that
However, in attempting to duplicate the rendering of the Bertin 1953 implemented in D3 and shown in the gallery at https://github.com/d3/d3-geo-projection , I found that the northern hemisphere wasn't coming out right. Double-checking the code for that warp, I found that the Javascript code on https://github.com/d3/d3-geo-projection/blob/master/src/bertin.js alters the value for xy.y (or r[1] in the d3-geo repo) rather than xy.x. Thus, if the JS code in the d3-geo repo is correct, then the code here in PROJ should read
@Fil, can you confirm?
The text was updated successfully, but these errors were encountered: