-
Notifications
You must be signed in to change notification settings - Fork 214
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
Area strategies for non-cartesian boxes. #832
Conversation
This is not my primary area of expertise and I'm suspicious about the result. In particular I'd be happy if you could double-check the math. @cffk would you be willing to review this PR? |
Sure, I'll take a look. |
EDIT: Before I showed different results for GeographicLib. This was my fault. I switched lat and lon when passing them to
In case you were wondering what's the polygon. E.g. in the last case it's
|
Now I approximate boxes with polygons. The number of additional points for horizontal edges depends on
The results are not exactly the same but this is probably caused by the fact that it is not possible to represent a box with a polygon. |
How does the approximation influence the results?
It seems that in the second case vincenty is the most different but in the last case andoyer's difference skyrockets while GeographicLib becomes closer each time. In the last case the difference for spherical increases as well. |
GeographicLib allows you to compute the area of a "box" (edges are circles of latitude + meridians) using rhumb lines. E.g., use the Planimeter -w -p 10 -R <<EOF
0 88
1 88
1 89
0 89
EOF gives 4 229233.7288327920 326564202.31213 |
I recommend using using the formula in terms of The area from of a box of longitude width
For
For
where I'm not sure how boost deals with the longitude wrapping around. You'll need to make sure that the box
returns the expected result. |
Right, thanks! So mixing both libraries would look like this:
Plus maybe normalization of longitudes because BG boxes may have max longitude > 180. Ok:
|
@cffk Thanks!
Right, this is the same integral that I'm using but with
That's interesting. When I use the exact script you pasted maxima still generates formula with logarithms. What am I missing? |
You're missing the fact that maxima doesn't always give you the most simplified form! The |
|
I don't expect that maxima can always get an expression into the form I want. Sometimes I have to nurse it along. That's the case here. You can use |
I recommend sanitizing your PR by removing trailing blanks (and untabifying if necessary). |
@cffk What do you mean by "removing trailing blanks"? Do you mean spaces at the end of the line? If not maybe you could point out the place in the PR e.g. by commenting in a specific line? |
Yes, I just mean spaces at the end of the line (such as are removed by Emacs' M-x delete-trailing-whitespace). |
443db16
to
fc34524
Compare
@barendgehrels @vissarion Are you ok with this change? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am OK with merging.
The intention of this PR is to fix issue: #439
The approach for spherical and geographic coordinate systems is as follows:
See the comments in the files defining strategies for the sources and maxima scripts.
The surprising part is that it seems that there is a closed equation for spheroidal element and no integration nor expressing the integral as a series is needed.
For now I verified the results only for some specific cases, i.e. 1/8 of the globe or the whole globe because it's possible to create a corresponding polygon. For WGS84 spheroid and sphere of mean radius of WGS84 spheroid the results are:
poly
are calculated for polygon covering 1/8 of a globe multiplied by 8.